Skip to content

Commit

Permalink
Add Platform::SharedPtr, similar to Platform::UniquePtr
Browse files Browse the repository at this point in the history
  • Loading branch information
msandstedt committed Dec 23, 2021
1 parent ebe2c97 commit 1056794
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib/support/CHIPMem.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,15 @@ inline UniquePtr<T> MakeUnique(Args &&... args)
return UniquePtr<T>(New<T>(std::forward<Args>(args)...));
}

template <typename T>
using SharedPtr = std::shared_ptr<T>;

template <typename T, typename... Args>
inline SharedPtr<T> MakeShared(Args &&... args)
{
return SharedPtr<T>(New<T>(std::forward<Args>(args)...), Deleter<T>());
}

// See MemoryDebugCheckPointer().
extern bool MemoryInternalCheckPointer(const void * p, size_t min_size);

Expand Down

0 comments on commit 1056794

Please sign in to comment.