diff --git a/xo-alloc/include/xo/alloc/Object.hpp b/xo-alloc/include/xo/alloc/Object.hpp index a29b8de5..5727331e 100644 --- a/xo-alloc/include/xo/alloc/Object.hpp +++ b/xo-alloc/include/xo/alloc/Object.hpp @@ -39,6 +39,11 @@ namespace xo { template gc_ptr(const gc_ptr & x) : ptr_{x.ptr()} {} + /** convenience for static asserts **/ + static constexpr bool is_gc_ptr = true; + /** see also: xo/refcnt/Refcounted.hpp **/ + static constexpr bool is_rc_ptr = false; + static bool is_eq(gc_ptr x1, gc_ptr x2) { std::uintptr_t u1 = reinterpret_cast(x1.ptr()); std::uintptr_t u2 = reinterpret_cast(x2.ptr()); diff --git a/xo-refcnt/include/xo/refcnt/Refcounted.hpp b/xo-refcnt/include/xo/refcnt/Refcounted.hpp index 732acb0b..622f2a74 100644 --- a/xo-refcnt/include/xo/refcnt/Refcounted.hpp +++ b/xo-refcnt/include/xo/refcnt/Refcounted.hpp @@ -80,6 +80,11 @@ namespace xo { x.ptr_ = nullptr; } + /** convenience tests for static_assert() **/ + static constexpr bool is_rc_ptr = true; + /** see also: xo/alloc/Object.hpp **/ + static constexpr bool is_gc_ptr = false; + /* aliasing ctor. see ctor (8) here: * [[https://en.cppreference.com/w/cpp/memory/shared_ptr/shared_ptr]] * and this dicsussion: