Documentation of memory
A stateful RawAllocator that handles temporary allocations.
It works similar to
alloca() but uses a seperate memory_stack for the allocations, instead of the actual program stack. This avoids the stack overflow error and is portable, with a similar speed. All allocations done in the scope of the allocator object are automatically freed when the object is destroyed.
|temporary_allocator (temporary_stack &stack)|
|temporary_allocator (temporary_allocator &&)=delete|
|temporary_allocator &||operator= (temporary_allocator &&)=delete|
|void *||allocate (std::size_t size, std::size_t alignment)|
|bool||is_active () const noexcept|
|void||shrink_to_fit () noexcept|
|temporary_stack &||get_stack () const noexcept|
- Creates it by giving it the temporary_stack it uses for allocation.
- Whether or not the allocator object is active.
- The active allocator object is the last object created for one stack. Moving changes the active allocator.
- Instructs it to release unnecessary memory after automatic unwinding occurs. This will effectively forward to memory_stack::shrink_to_fit() of the internal stack.
- The internal stack the temporary allocator is using.
Generated by 1.8.12