Reallocate-Arena #1

Merged
Patedam merged 7 commits from Reallocate-Arena into main 2026-02-14 11:24:30 -05:00
Showing only changes of commit c6552d2def - Show all commits

View File

@@ -12,6 +12,7 @@ namespace Juliet
void Create() void Create()
{ {
Assert(!Arena); Assert(!Arena);
static_assert(AllowRealloc == false);
DataFirst = DataLast = nullptr; DataFirst = DataLast = nullptr;
Count = 0; Count = 0;
@@ -25,7 +26,6 @@ namespace Juliet
void Create(NonNullPtr<Arena> arena) void Create(NonNullPtr<Arena> arena)
{ {
Assert(!Arena); Assert(!Arena);
static_assert(AllowRealloc == false);
DataFirst = DataLast = nullptr; DataFirst = DataLast = nullptr;
Count = 0; Count = 0;
@@ -72,6 +72,12 @@ namespace Juliet
{ {
Assert(Arena); Assert(Arena);
if (Count + 1 == Capacity)
{
Assert(AllowRealloc);
Reserve(Capacity * 2);
}
Type* entry = Data + Count; Type* entry = Data + Count;
*entry = value; *entry = value;
@@ -87,6 +93,12 @@ namespace Juliet
{ {
Assert(Arena); Assert(Arena);
if (Count + 1 == Capacity)
{
Assert(AllowRealloc);
Reserve(Capacity * 2);
}
Type* entry = Data + Count; Type* entry = Data + Count;
*entry = std::move(value); *entry = std::move(value);