xo-alloc2: + RAllocator.alloc_copy_for convenience method
This commit is contained in:
parent
cb29d009d3
commit
176be07731
1 changed files with 6 additions and 1 deletions
|
|
@ -36,11 +36,16 @@ namespace xo {
|
||||||
return O::iface()->alloc(O::data(), typeseq::id<T>(), n);
|
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>
|
template <typename T>
|
||||||
T * std_copy_for(const T * src) noexcept {
|
T * std_copy_for(const T * src) noexcept {
|
||||||
// TODO: fix alloc_copy(), should take const std::byte *
|
// 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) {
|
if (copy) {
|
||||||
*copy = *src;
|
*copy = *src;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue