From 176be07731ab6df01815931c72d2fda67921983f Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sun, 15 Feb 2026 14:09:52 -0500 Subject: [PATCH] xo-alloc2: + RAllocator.alloc_copy_for convenience method --- xo-alloc2/include/xo/alloc2/alloc/RAllocator.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xo-alloc2/include/xo/alloc2/alloc/RAllocator.hpp b/xo-alloc2/include/xo/alloc2/alloc/RAllocator.hpp index 729778e9..4d2af7f7 100644 --- a/xo-alloc2/include/xo/alloc2/alloc/RAllocator.hpp +++ b/xo-alloc2/include/xo/alloc2/alloc/RAllocator.hpp @@ -36,11 +36,16 @@ namespace xo { return O::iface()->alloc(O::data(), typeseq::id(), n); } + template + void * alloc_copy_for(const T * src) noexcept { + return O::iface()->alloc_copy(O::data(), (std::byte*)const_cast(src)); + } + 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)); + T * copy = (T *)(this->alloc_copy_for(src)); if (copy) { *copy = *src;