tlx
|
Storage area allocated on the stack and usable by a StackAllocator. More...
#include <stack_allocator.hpp>
Classes | |
union | AlignmentHelper |
union to enforce alignment of buffer area More... | |
Public Member Functions | |
StackArena () noexcept | |
default constructor: free pointer at the beginning. More... | |
~StackArena () | |
destructor clears ptr_ for debugging. More... | |
StackArena (const StackArena &)=delete | |
StackArena & | operator= (const StackArena &)=delete |
char * | allocate (size_t n) |
void | deallocate (char *p, size_t n) noexcept |
size_t | used () const noexcept |
return number of bytes used in StackArena More... | |
void | reset () noexcept |
reset memory area More... | |
Static Public Member Functions | |
static constexpr size_t | size () noexcept |
size of memory area More... | |
Private Member Functions | |
bool | pointer_in_buffer (char *p) noexcept |
debug method to check whether ptr_ is still in buf_. More... | |
Private Attributes | |
union { | |
char buf_ [Size] | |
stack memory area used for allocations. More... | |
AlignmentHelper dummy_for_alignment_ | |
enforce alignment More... | |
}; | |
char * | ptr_ |
pointer into free bytes in buf_ More... | |
Static Private Attributes | |
static constexpr size_t | alignment |
Storage area allocated on the stack and usable by a StackAllocator.
Definition at line 32 of file stack_allocator.hpp.
|
inlinenoexcept |
default constructor: free pointer at the beginning.
Definition at line 64 of file stack_allocator.hpp.
|
inline |
destructor clears ptr_ for debugging.
Definition at line 67 of file stack_allocator.hpp.
|
delete |
|
inline |
Definition at line 72 of file stack_allocator.hpp.
|
inlinenoexcept |
Definition at line 88 of file stack_allocator.hpp.
|
delete |
|
inlineprivatenoexcept |
debug method to check whether ptr_ is still in buf_.
Definition at line 59 of file stack_allocator.hpp.
|
inlinenoexcept |
reset memory area
Definition at line 110 of file stack_allocator.hpp.
|
inlinestaticnoexcept |
size of memory area
Definition at line 104 of file stack_allocator.hpp.
|
inlinenoexcept |
return number of bytes used in StackArena
Definition at line 107 of file stack_allocator.hpp.
union { ... } |
|
staticprivate |
Definition at line 34 of file stack_allocator.hpp.
char buf_[Size] |
stack memory area used for allocations.
Definition at line 50 of file stack_allocator.hpp.
AlignmentHelper dummy_for_alignment_ |
enforce alignment
Definition at line 52 of file stack_allocator.hpp.
|
private |
pointer into free bytes in buf_
Definition at line 56 of file stack_allocator.hpp.