xo-alloc2: + RAllocator.alloc_copy_for convenience method

This commit is contained in:
Roland Conybeare 2026-02-15 14:09:52 -05:00
commit 176be07731

View file

@ -36,11 +36,16 @@ namespace xo {
return O::iface()->alloc(O::data(), typeseq::id<T>(), n);
}
template <typename T>
void * alloc_copy_for(const T * src) noexcept {
return O::iface()->alloc_copy(O::data(), (std::byte*)const_cast<T *>(src));
}
template <typename T>
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<T *>(src));
T * copy = (T *)(this->alloc_copy_for(src));
if (copy) {
*copy = *src;