From 105679466b432b90ce464a255dffb5489ff5795f Mon Sep 17 00:00:00 2001 From: Michael Sandstedt Date: Mon, 20 Dec 2021 11:02:43 -0600 Subject: [PATCH] Add Platform::SharedPtr, similar to Platform::UniquePtr --- src/lib/support/CHIPMem.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lib/support/CHIPMem.h b/src/lib/support/CHIPMem.h index 14164f1e310c6f..3bd852210de5a4 100644 --- a/src/lib/support/CHIPMem.h +++ b/src/lib/support/CHIPMem.h @@ -179,6 +179,15 @@ inline UniquePtr MakeUnique(Args &&... args) return UniquePtr(New(std::forward(args)...)); } +template +using SharedPtr = std::shared_ptr; + +template +inline SharedPtr MakeShared(Args &&... args) +{ + return SharedPtr(New(std::forward(args)...), Deleter()); +} + // See MemoryDebugCheckPointer(). extern bool MemoryInternalCheckPointer(const void * p, size_t min_size);