File indexing completed on 2025-01-18 10:04:58
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 Handle(NCollection_BaseAllocator)& theAlloc,
0033 Args&&... theArgs)
0034 {
0035 return std::allocate_shared<T, NCollection_OccAllocator<T>, Args...>(NCollection_OccAllocator<T>(theAlloc),
0036 std::forward<Args>(theArgs)...);
0037 }
0038
0039 template< class T, class... Args >
0040 std::shared_ptr<T> make_oshared(const NCollection_OccAllocator<T>& theAlloc,
0041 Args&&... theArgs)
0042 {
0043 return std::allocate_shared<T, NCollection_OccAllocator<T>, Args...>(theAlloc,
0044 std::forward<Args>(theArgs)...);
0045 }
0046
0047 template< class T, class... Args >
0048 std::shared_ptr<T> make_oshared(NCollection_OccAllocator<T>&& theAlloc,
0049 Args&&... theArgs)
0050 {
0051 return std::allocate_shared<T, NCollection_OccAllocator<T>, Args...>(std::forward<NCollection_OccAllocator<T>(>theAlloc),
0052 std::forward<Args>(theArgs)...);
0053 }
0054
0055 template <typename T, class... Args>
0056 std::unique_ptr<T> make_unique(Args&&... theArgs)
0057 {
0058 return std::unique_ptr<T>(new T(std::forward<Args>(theArgs)...));
0059 }
0060 }
0061
0062 #endif