![]() |
Raven Engine v0.1
|
Stack-based allocator for objects of type T. More...
#include <StackAllocator.h>
Public Member Functions | |
| StackAllocator (usize size) | |
| Constructs the allocator with capacity for given elements. | |
| ~StackAllocator () | |
| Destructor. Releases the allocated memory block. | |
| T * | Allocate (usize count) |
| Allocates space for count objects of type T. | |
| void | Reset () |
| Resets the allocator, making all memory available again. | |
Stack-based allocator for objects of type T.
Allocates a fixed block of memory for T objects and provides fast bump-pointer allocation. Does not support individual deallocation; use Reset() to clear all allocations.
| T | The element type to allocate. |
|
inlineexplicit |
Constructs the allocator with capacity for given elements.
| size | Number of T elements the allocator can hold. |
|
inline |
Destructor. Releases the allocated memory block.
|
inline |
Allocates space for count objects of type T.
Aligns the returned pointer to alignof(T). If insufficient space remains, returns nullptr.
| count | Number of T objects to allocate. |
|
inline |
Resets the allocator, making all memory available again.