From fa3e988b1e497e1defca64cd06e679fca2324e2f Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sat, 4 Apr 2026 14:38:57 -0400 Subject: [PATCH] xo-alloc2: Use move semantics for std_copy_for Prep for moving to ACollector interface --- xo-alloc2/include/xo/alloc2/alloc/RAllocator.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xo-alloc2/include/xo/alloc2/alloc/RAllocator.hpp b/xo-alloc2/include/xo/alloc2/alloc/RAllocator.hpp index b5252f49..1d04d9cb 100644 --- a/xo-alloc2/include/xo/alloc2/alloc/RAllocator.hpp +++ b/xo-alloc2/include/xo/alloc2/alloc/RAllocator.hpp @@ -42,14 +42,14 @@ namespace xo { } template - T * std_copy_for(const T * src) noexcept { - T * copy = (T *)(this->alloc_copy_for(src)); + T * std_copy_for(T * src) noexcept { + void * mem = this->alloc_copy_for(src); - if (copy) { - *copy = *src; + if (mem) { + return new (mem) T(std::move(*src)); } - return copy; + return nullptr; } typeseq _typeseq() const noexcept { return O::iface()->_typeseq(); }