File indexing completed on 2026-09-17 09:21:57
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _Standard_MemoryUtils_HeaderFile
0015 #define _Standard_MemoryUtils_HeaderFile
0016
0017 #include <NCollection_Allocator.hxx>
0018 #include <NCollection_OccAllocator.hxx>
0019
0020 #include <memory>
0021
0022 namespace opencascade
0023 {
0024 template <class T, class... Args>
0025 std::shared_ptr<T> make_shared(Args&&... theArgs)
0026 {
0027 return std::allocate_shared<T, NCollection_Allocator<T>, Args...>(NCollection_Allocator<T>(),
0028 std::forward<Args>(theArgs)...);
0029 }
0030
0031 template <class T, class... Args>
0032 std::shared_ptr<T> make_oshared(const occ::handle<NCollection_BaseAllocator>& theAlloc,
0033 Args&&... theArgs)
0034 {
0035 return std::allocate_shared<T, NCollection_OccAllocator<T>, Args...>(
0036 NCollection_OccAllocator<T>(theAlloc),
0037 std::forward<Args>(theArgs)...);
0038 }
0039
0040 template <class T, class... Args>
0041 std::shared_ptr<T> make_oshared(const NCollection_OccAllocator<T>& theAlloc, Args&&... theArgs)
0042 {
0043 return std::allocate_shared<T, NCollection_OccAllocator<T>, Args...>(
0044 theAlloc,
0045 std::forward<Args>(theArgs)...);
0046 }
0047
0048 template <class T, class... Args>
0049 std::shared_ptr<T> make_oshared(NCollection_OccAllocator<T>&& theAlloc, Args&&... theArgs)
0050 {
0051 return std::allocate_shared<T, NCollection_OccAllocator<T>, Args...>(
0052 std::forward<NCollection_OccAllocator<T>>(theAlloc),
0053 std::forward<Args>(theArgs)...);
0054 }
0055
0056 template <typename T, class... Args>
0057 std::unique_ptr<T> make_unique(Args&&... theArgs)
0058 {
0059 return std::unique_ptr<T>(new T(std::forward<Args>(theArgs)...));
0060 }
0061 }
0062
0063 #endif