![]() |
Allocators
|
Segregates allocation strategies according to the given allocation size threshold. More...
#include <segregator.hpp>
Public Member Functions | |
memory_block | allocate (std::size_t size) |
Allocates a memory block of the given size. More... | |
void | deallocate (memory_block &block) |
Deallocates the given memory_block if possible. More... | |
bool | owns (memory_block &block) |
Checks if the given memory block has been allocated by this allocator. More... | |
primary_allocator & | get_primary () noexcept |
Gets a reference to the primary allocator. More... | |
secondary_allocator & | get_secondary () noexcept |
Gets a reference to the secondary allocator. More... | |
Segregates allocation strategies according to the given allocation size threshold.
Segregates the given allocators in a way it uses the first one for allocation of all blocks which size is less or equal to the given threshold and the second allocator for blocks larger than the threshold.
threshold | Size threshold used as segregation criteria. |
primary_allocator | Allocator used for allocation of blocks smaller or equal to threshold. |
secondary_allocator | Allocator used for allocation of blocks larger than threshold. |
Definition at line 31 of file segregator.hpp.
|
inline |
Allocates a memory block of the given size.
size | Size of a block to be allocated. |
Definition at line 17 of file segregator.ipp.
|
inline |
Deallocates the given memory_block if possible.
block | The block to deallocate. |
Definition at line 32 of file segregator.ipp.
Referenced by boost::memory::segregator< threshold, primary_allocator, secondary_allocator >::deallocate().
|
inlinenoexcept |
Gets a reference to the primary allocator.
Definition at line 59 of file segregator.ipp.
|
inlinenoexcept |
Gets a reference to the secondary allocator.
Definition at line 71 of file segregator.ipp.
|
inline |
Checks if the given memory block has been allocated by this allocator.
block | A block to check. |
Definition at line 47 of file segregator.ipp.