From c6552d2def5fd56b636cd6724520f345868c1fff Mon Sep 17 00:00:00 2001 From: Patedam Date: Fri, 13 Feb 2026 22:02:11 -0500 Subject: [PATCH] Allow reallocating when we use external arena. Internal arena do not need reallocate as it is consecutive memory --- Juliet/include/Core/Container/Vector.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Juliet/include/Core/Container/Vector.h b/Juliet/include/Core/Container/Vector.h index 081d65f..ba529be 100644 --- a/Juliet/include/Core/Container/Vector.h +++ b/Juliet/include/Core/Container/Vector.h @@ -12,6 +12,7 @@ namespace Juliet void Create() { Assert(!Arena); + static_assert(AllowRealloc == false); DataFirst = DataLast = nullptr; Count = 0; @@ -25,7 +26,6 @@ namespace Juliet void Create(NonNullPtr arena) { Assert(!Arena); - static_assert(AllowRealloc == false); DataFirst = DataLast = nullptr; Count = 0; @@ -72,6 +72,12 @@ namespace Juliet { Assert(Arena); + if (Count + 1 == Capacity) + { + Assert(AllowRealloc); + Reserve(Capacity * 2); + } + Type* entry = Data + Count; *entry = value; @@ -87,6 +93,12 @@ namespace Juliet { Assert(Arena); + if (Count + 1 == Capacity) + { + Assert(AllowRealloc); + Reserve(Capacity * 2); + } + Type* entry = Data + Count; *entry = std::move(value);