summaryrefslogtreecommitdiff
path: root/asl/box.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'asl/box.hpp')
-rw-r--r--asl/box.hpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/asl/box.hpp b/asl/box.hpp
index 795b6dd..9d3c7f0 100644
--- a/asl/box.hpp
+++ b/asl/box.hpp
@@ -35,6 +35,13 @@ public:
, m_alloc{ASL_MOVE(other.m_alloc)}
{}
+ template<is_object U>
+ requires convertible_from<T*, U*>
+ constexpr box(box<U, Allocator>&& other) // NOLINT(*-explicit-conversions)
+ : m_ptr{exchange(other.m_ptr, nullptr)}
+ , m_alloc{ASL_MOVE(other.m_alloc)}
+ {}
+
constexpr box& operator=(box&& other)
{
if (this == &other) { return *this; }
@@ -93,6 +100,9 @@ public:
template<is_object U, allocator A>
friend constexpr U* leak(box<U, A>&&);
+
+ template<is_object U, allocator A>
+ friend class box;
};
template<is_object T, allocator Allocator = DefaultAllocator, typename... Args>