xo-alloc2: ++ plumbing for AAllocator / DArena

This commit is contained in:
Roland Conybeare 2025-12-12 01:02:45 -05:00
commit e0dd9d2a1c
10 changed files with 223 additions and 91 deletions

View file

@ -6,18 +6,29 @@
#pragma once
#include "xo/facet/RRouter.hpp"
#include <string>
namespace xo {
namespace mm {
/** @class RAllocator **/
template <typename Object>
struct RAllocator : public Object {
private:
using O = Object;
public:
using ObjectType = Object;
using size_type = std::size_t;
RAllocator() {}
RAllocator(Object::DataPtr data) : Object{std::move(data)} {}
int32_t _typeseq() const { return Object::iface()->_typeseq(); }
int32_t _typeseq() const { return O::iface()->_typeseq(); }
const std::string & name() const { return O::iface()->name(O::data()); }
size_type reserved() const { return O::iface()->reserved(O::data()); }
size_type size() const { return O::iface()->size(O::data()); }
size_type committed() const { return O::iface()->committed(O::data()); }
bool contains(const void * p) const { return O::iface()->contains(O::data(), p); }
std::byte * alloc(size_type z) { return O::iface()->alloc(O::data(), z); }
static bool _valid;
};