From 8de4bbd83f0ff5f1f1fa51b60d24518edc8a9a7e Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sun, 29 Mar 2026 15:17:31 -0400 Subject: [PATCH] xo-gc: use DArenaVector for DX1Collector.object_types_ Original implementation predated DArenaVector, using it is more natural --- include/xo/arena/DArenaVector.hpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include/xo/arena/DArenaVector.hpp b/include/xo/arena/DArenaVector.hpp index 0ac5d68..21e059d 100644 --- a/include/xo/arena/DArenaVector.hpp +++ b/include/xo/arena/DArenaVector.hpp @@ -89,7 +89,8 @@ namespace xo { * Always limited by ArenaConfig.size_ **/ void reserve(size_type z); - void resize(size_type z); + /** resize to size @p z. Return true on success. May fail iff oom. **/ + bool resize(size_type z); void shrink_to_fit(); /** reset vector to empty state **/ void clear(); @@ -184,7 +185,7 @@ namespace xo { } template - void + bool DArenaVector::resize(size_type z) { // new arena size in bytes size_t req_z = z * sizeof(T); @@ -192,7 +193,8 @@ namespace xo { if (z > size_) { // expand arena to accomodate - store_.expand(req_z); + if (!store_.expand(req_z)) + return false; // run ctors if constexpr (std::is_trivially_constructible_v) { @@ -226,6 +228,8 @@ namespace xo { store_.alloc(xo::reflect::typeseq::id(), req_z); this->size_ = z; + + return true; } template