Flow
Documentation for the Flow C++ Library
|
A stack-based memory resource that allocates memory in a LIFO order from a fixed buffer. Deallocation must happen in reverse order of allocation. Throws std::bad_alloc if there is insufficient space for an allocation. More...
#include <flow_stack_memory_resource.h>
Classes | |
struct | Header |
Public Member Functions | |
StackMemoryResource (void *buffer, std::size_t capacity) noexcept | |
Public Member Functions inherited from flow::MemoryResource | |
virtual | ~MemoryResource ()=default |
void * | allocate (std::size_t bytes, std::size_t alignment=alignof(std::max_align_t)) |
void | deallocate (void *address, std::size_t bytes, std::size_t alignment=alignof(std::max_align_t)) |
Protected Member Functions | |
virtual void * | allocateImp (std::size_t bytes, std::size_t alignment) override |
virtual void | deallocateImp (void *address, std::size_t bytes, std::size_t alignment) override |
Protected Attributes | |
void * | buffer_ |
std::size_t | capacity_ |
A stack-based memory resource that allocates memory in a LIFO order from a fixed buffer. Deallocation must happen in reverse order of allocation. Throws std::bad_alloc if there is insufficient space for an allocation.
Definition at line 14 of file flow_stack_memory_resource.h.
|
inlineexplicitnoexcept |
Definition at line 16 of file flow_stack_memory_resource.h.
|
inlineoverrideprotectedvirtual |
Implements flow::MemoryResource.
Definition at line 28 of file flow_stack_memory_resource.h.
References flow::alignWithHeader(), buffer_, and capacity_.
|
inlineoverrideprotectedvirtual |
Implements flow::MemoryResource.
Definition at line 43 of file flow_stack_memory_resource.h.
References buffer_, capacity_, flow::StackMemoryResource::Header::oldBuffer, and flow::pointerDistance().
|
protected |
Definition at line 25 of file flow_stack_memory_resource.h.
Referenced by allocateImp(), and deallocateImp().
|
protected |
Definition at line 26 of file flow_stack_memory_resource.h.
Referenced by allocateImp(), and deallocateImp().