refactor: use GCObjectVisitor api w/ gco_shallow_move

This commit is contained in:
Roland Conybeare 2026-04-06 15:21:48 -04:00
commit 3489699f5d
8 changed files with 51 additions and 15 deletions

View file

@ -46,9 +46,25 @@ public:
///@{
// explicit injected content
/** convenience: allocate copy for typed pointer **/
template <typename T>
void * alloc_copy_for(const T * src) noexcept {
return O::iface()->alloc_copy(O::data(), (std::byte *)const_cast<T *>(src));
}
/** visit forward faceted object child pointer in place.
Defined in RGCObject.hpp to avoid #include cycle
/** convenience: move typed pointer **/
template <typename T>
T * std_move_for(T * src) noexcept {
void * mem = this->alloc_copy_for(src);
if (mem) {
return new (mem) T(std::move(*src));
}
return nullptr;
}
/** visit a gcobject child pointer in place.
Defined in RCollector_aux.hpp to avoid #include cycle
(for historical reasons - coul d be in RGCObject_aux.hpp?)
**/
template <typename DRepr>
void visit_child(xo::facet::obj<AGCObject,DRepr> * p_obj);