Stack allocator capable of instantiating any default-constructible object on stack. Every allocation comes with a 16-bytes long sentinel object.
More...
#include <stack_allocator.h>
|
|
| StackAllocator (const StackAllocator &)=delete |
| |
|
| StackAllocator (StackAllocator &&)=delete |
| |
|
StackAllocator & | operator= (const StackAllocator &)=delete |
| |
|
StackAllocator & | operator= (StackAllocator &&)=delete |
| |
| template<typename T > |
| GAIA_NODISCARD T * | alloc (uint32_t cnt) |
| | Allocates.
|
| |
| void | free (void *pData, uint32_t cnt) |
| | Frees the last allocated object from the stack.
|
| |
|
void | reset () |
| | Frees all allocated objects from the buffer.
|
| |
|
GAIA_NODISCARD constexpr uint32_t | capacity () |
| |
template<uint32_t CapacityInBytes = 1024>
class gaia::mem::StackAllocator< CapacityInBytes >
Stack allocator capable of instantiating any default-constructible object on stack. Every allocation comes with a 16-bytes long sentinel object.
◆ alloc()
template<uint32_t CapacityInBytes = 1024>
template<typename T >
Allocates.
- Parameters
-
- Template Parameters
-
| T | inside the buffer. No default initialization is done so the object is returned in a non-initialized state unless a custom constructor is provided. |
- Returns
- Pointer to the first allocated object
◆ free()
template<uint32_t CapacityInBytes = 1024>
Frees the last allocated object from the stack.
- Parameters
-
| pData | Pointer to the last allocated object on the stack |
| cnt | Number of objects that were allocated on the given memory address |
The documentation for this class was generated from the following file: