diff options
author | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2025-01-26 22:35:47 +0100 |
---|---|---|
committer | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2025-01-26 22:45:42 +0100 |
commit | b3f2336e1b8f4410515344feb73d992d854c8282 (patch) | |
tree | 5b4de235b46a6081206b17761acc1bab1ea5c720 /asl/box.hpp | |
parent | cf7db48c261ee9c896c813a38ff8c59da5b8fe07 (diff) |
Implement logging
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 |