diff --git a/xo-alloc2/include/xo/alloc2/dp.hpp b/xo-alloc2/include/xo/alloc2/dp.hpp index 266f42dd..8f61b7e1 100644 --- a/xo-alloc2/include/xo/alloc2/dp.hpp +++ b/xo-alloc2/include/xo/alloc2/dp.hpp @@ -19,6 +19,9 @@ namespace xo { **/ template struct dp { + using repr_type = DRepr; + + public: dp() = default; /** dp takes ownership of data @p ptr; @@ -55,6 +58,8 @@ namespace xo { } } + static constexpr bool is_gc_eligible() { return DRepr::is_gc_eligible(); } + dp & operator=(const dp & x) = delete; /** move assignment **/ @@ -74,6 +79,17 @@ namespace xo { DRepr * operator->() const noexcept { return ptr_; } DRepr & operator*() const noexcept { return *ptr_; } + /** transfer responsibility for pointer to caller, + * setting dp container's copy to nullptr + **/ + DRepr * release() noexcept { + DRepr * retval = ptr_; + + this->ptr_ = nullptr; + + return retval; + } + #ifdef NOT_YET /** explicit conversion to obj **/ obj to_op() const noexcept {