KTL
|
A linear allocator which gives out chunks of its internal stack. Increments a counter during allocation, which makes it very fast but also unlikely to deallocate it again. Has a max allocation size of the Size
given.
More...
#include <linear_allocator.h>
Public Member Functions | |
linear_allocator () noexcept | |
linear_allocator (const linear_allocator &) noexcept=delete | |
linear_allocator (linear_allocator &&other) noexcept | |
Move constructor. More... | |
linear_allocator & | operator= (const linear_allocator &) noexcept=delete |
linear_allocator & | operator= (linear_allocator &&rhs) noexcept |
Move assignment operator. More... | |
bool | operator== (const linear_allocator &rhs) const noexcept |
bool | operator!= (const linear_allocator &rhs) const noexcept |
void * | allocate (size_t n) noexcept |
Attempts to allocate a chunk of memory defined by n . More... | |
void | deallocate (void *p, size_t n) noexcept |
Attempts to deallocate the memory at location p . More... | |
size_t | max_size () const noexcept |
Returns the maximum size that an allocation can be. More... | |
bool | owns (void *p) const noexcept |
Returns whether or not the allocator owns the given location in memory. More... | |
A linear allocator which gives out chunks of its internal stack. Increments a counter during allocation, which makes it very fast but also unlikely to deallocate it again. Has a max allocation size of the Size
given.
|
inlinenoexcept |
|
deletenoexcept |
|
inlinenoexcept |
Move constructor.
other | The original allocator |
|
inlinenoexcept |
Attempts to allocate a chunk of memory defined by n
.
n | The amount of bytes to allocate memory for |
n
bytes big or nullptr if it could not be allocated
|
inlinenoexcept |
Attempts to deallocate the memory at location p
.
p | The location in memory to deallocate |
n | The size that was initially allocated |
|
inlinenoexcept |
Returns the maximum size that an allocation can be.
|
inlinenoexcept |
|
deletenoexcept |
|
inlinenoexcept |
Move assignment operator.
rhs | The original allocator |
|
inlinenoexcept |
|
inlinenoexcept |
Returns whether or not the allocator owns the given location in memory.
p | The location of the object in memory |
p