refactor: + narrower interface for gc pointer forwarding

add AGCObjectVisitor, instead of requiring ACollector.
This commit is contained in:
Roland Conybeare 2026-04-05 23:53:02 -04:00
commit 72cbffba46
8 changed files with 25 additions and 15 deletions

View file

@ -7,6 +7,7 @@
#include <xo/alloc2/Allocator.hpp>
#include <xo/alloc2/Collector.hpp>
#include <xo/alloc2/GCObjectVisitor.hpp>
#include <xo/facet/obj.hpp>
#include <xo/indentlog/print/ppindentinfo.hpp>
#include <string_view>
@ -47,6 +48,8 @@ namespace xo {
using AAllocator = xo::mm::AAllocator;
/** garbage collector **/
using ACollector = xo::mm::ACollector;
/** object visitor (garbage collector proxy) **/
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
/** ppindentinfo for APrintable **/
using ppindentinfo = xo::print::ppindentinfo;
///@}
@ -247,10 +250,10 @@ namespace xo {
/** clone string, using memory from allocator @p mm **/
DString * shallow_move(obj<ACollector> gc) noexcept;
size_type forward_children(obj<ACollector> gc) noexcept;
/** fixup child pointers (trivial for DString, no children)
* note: cref so we can use forward decl
**/
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
///@}