template<class BlockOrRawAllocator = default_allocator>
class foonathan::memory::memory_stack< BlockOrRawAllocator >
A stateful RawAllocator that provides stack-like (LIFO) allocations.
It uses a memory_arena with a given BlockOrRawAllocator
defaulting to growing_block_allocator to allocate huge blocks and saves a marker to the current top. Allocation simply moves this marker by the appropriate number of bytes and returns the pointer at the old marker position, deallocation is not directly supported, only setting the marker to a previously queried position.
template<class BlockOrRawAllocator = default_allocator>
The marker type that is used for unwinding.
The exact type is implementation defined, it is only required that it is efficiently copyable and has all the comparision operators defined for two markers on the same stack. Two markers are equal, if they are copies or created from two top()
calls without a call to unwind()
or allocate()
. A marker a
is less than marker b
, if after a
was obtained, there was one or more call to allocate()
and no call to unwind()
.