![]() |
Allocators
|
Allocator adding prefix and suffix objects in boundries of allocated block. More...
#include <affix_allocator.hpp>
Public Types | |
using | allocator_type = allocator |
using | prefix_type = prefix |
using | suffix_type = suffix |
Public Member Functions | |
memory_block | allocate (std::size_t size) |
Allocates a memory_block with configured affixes. More... | |
void | deallocate (memory_block &block) |
Deallocates the given memory_block More... | |
bool | owns (memory_block &block) |
Determines if the given memory_block is owned by this allocator. More... | |
Allocator adding prefix and suffix objects in boundries of allocated block.
allocator | The underlying allocator performing physical memory_block allocation for the requested block, prefix and suffix. |
prefix | Prefix type, it has to be a default constructable type. An instance of this type will be constructed just before requested block on allocate and destroyed on deallocate. |
suffix | Suffix type, it has to be a default constructable type. An instance of this type will be constructed just before requested block on allocate and destroyed on deallocate. |
verify | A boolean parameter indicating if prefix/suffix destructors should be invoked on deallocate. |
Definition at line 76 of file affix_allocator.hpp.
|
inline |
Allocates a memory_block with configured affixes.
Allocates a memory block of the given size using underlying allocator. Additionally prefix and suffix objects are constructed before and after returned memory block. These can be used for any purpose - tracking, debugging buffer under and overrun issues.
Definition at line 76 of file affix_allocator.ipp.
|
inline |
Deallocates the given memory_block
Attempts to deallocate the given memory block by destroying prefix and suffix instances affiliated to this block, but only if verify==*true*. memory_block is reclaimed only if it is owned by the underlying allocator.
block | The memory_block to deallocate. |
Definition at line 97 of file affix_allocator.ipp.
|
inline |
Determines if the given memory_block is owned by this allocator.
Ownership is determined by checking ownership of the underlying allocator for the complete block with defined prefix and suffix.
block |
Definition at line 122 of file affix_allocator.ipp.