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

@ -3,16 +3,7 @@
#include "xo/alloc2/AAllocator.hpp"
namespace xo {
using xo::facet::DVariantPlaceholder;
using xo::facet::typeseq;
using xo::facet::valid_facet_implementation;
namespace mm {
int32_t
IAllocator_Any::s_typeseq = typeseq::id<DVariantPlaceholder>;
bool
IAllocator_Any::_valid = valid_facet_implementation<AAllocator, IAllocator_Any>;
}
}

View file

@ -4,6 +4,7 @@ set(SELF_LIB xo_alloc2)
set(SELF_SRCS
AAllocator.cpp
DArena.cpp
IAllocator_Any.cpp
IAllocator_DArena.cpp
)

View file

@ -0,0 +1,24 @@
/** @file IAllocator_Any.cpp
*
* @author Roland Conybeare, Dec 2025
**/
#include "IAllocator_Any.hpp"
namespace xo {
using xo::facet::DVariantPlaceholder;
using xo::facet::typeseq;
using xo::facet::valid_facet_implementation;
namespace mm {
int32_t
IAllocator_Any::s_typeseq = typeseq::id<DVariantPlaceholder>();
bool
IAllocator_Any::_valid = valid_facet_implementation<AAllocator, IAllocator_Any>();
} /*namespace mm*/
} /*namespace xo*/
/* end IAllocator_Any.cpp */

View file

@ -5,6 +5,7 @@
#include "IAllocator_DArena.hpp"
#include <cassert>
#include <cstddef>
namespace xo {
namespace mm {
@ -14,6 +15,11 @@ namespace xo {
return s.config_.name_;
}
std::size_t
IAllocator_DArena::reserved(const DArena & s) {
return s.hi_ - s.lo_;
}
std::size_t
IAllocator_DArena::size(const DArena & s) {
return s.limit_ - s.lo_;