diff --git a/include/xo/alloc2/alloc/RAllocator.hpp b/include/xo/alloc2/alloc/RAllocator.hpp index 729778e..4d2af7f 100644 --- a/include/xo/alloc2/alloc/RAllocator.hpp +++ b/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;