diff options
Diffstat (limited to 'asl/box.hpp')
-rw-r--r-- | asl/box.hpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/asl/box.hpp b/asl/box.hpp index f193853..795b6dd 100644 --- a/asl/box.hpp +++ b/asl/box.hpp @@ -90,6 +90,9 @@ public: { return H::combine(ASL_MOVE(h), *b); } + + template<is_object U, allocator A> + friend constexpr U* leak(box<U, A>&&); }; template<is_object T, allocator Allocator = DefaultAllocator, typename... Args> @@ -111,5 +114,11 @@ constexpr box<T, Allocator> make_box(Args&&... args) return box<T>(ptr, ASL_MOVE(allocator)); } +template<is_object T, allocator A> +constexpr T* leak(box<T, A>&& b) +{ + return exchange(b.m_ptr, nullptr); +} + } // namespace asl |