From f209f7343c7cacf578f2731560c42ed8803ba4bc Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Fri, 13 Feb 2026 15:15:08 -0500 Subject: [PATCH] xo-gc stack: streamline object pointer forwarding --- include/xo/alloc2/alloc/RAllocator.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/xo/alloc2/alloc/RAllocator.hpp b/include/xo/alloc2/alloc/RAllocator.hpp index ecd80bb..6255241 100644 --- a/include/xo/alloc2/alloc/RAllocator.hpp +++ b/include/xo/alloc2/alloc/RAllocator.hpp @@ -36,6 +36,19 @@ namespace xo { return O::iface()->alloc(O::data(), typeseq::id(), sizeof(T)); } + template + T * std_copy_for(const T * src) noexcept { + // TODO: fix alloc_copy(), should take const std::byte * + + T * copy = (T *)O::iface()->alloc_copy(O::data(), (std::byte*)const_cast(src)); + + if (copy) { + *copy = *src; + } + + return copy; + } + typeseq _typeseq() const noexcept { return O::iface()->_typeseq(); } void _drop() const noexcept { O::iface()->_drop(O::data()); } std::string_view name() const noexcept { return O::iface()->name(O::data()); }