10 static_assert(std::is_trivially_destructible_v<T>,
"T must be trivially destructible");
15 : size(count * sizeof(T)), memory(new char[count * sizeof(T)]), next(memory) {}
24 if (std::cmp_greater_equal(next - memory, size)) {
25 throw std::bad_alloc();
30 T *
const result =
new (next) T;
bool isDeallocSupported()
Reports that per-element deallocate is not supported (false for this allocator).
LinearAllocator & operator=(const LinearAllocator &)=delete
T * allocate()
Bump-allocates one T; throws std::bad_alloc when the arena is exhausted.
LinearAllocator(std::size_t count)
Reserves room for count objects of T from a single backing allocation.
void reset()
Rewinds the bump pointer, reclaiming every outstanding allocation in one shot.
LinearAllocator(const LinearAllocator &)=delete
void deallocate(T *)
No-op: trivial destructibility lets per-element reclamation be skipped.