Allocator Builder
Policy Based C++ Template Allocator Library
|
#include <cascading_allocator.hpp>
Public Types | |
using | allocator = Allocator |
Public Member Functions | |
cascading_allocator_base (cascading_allocator_base &&x) noexcept | |
cascading_allocator_base & | operator= (cascading_allocator_base &&x) noexcept |
~cascading_allocator_base () | |
block | allocate (size_t n) noexcept |
void | deallocate (block &b) noexcept |
bool | reallocate (block &b, size_t n) noexcept |
template<typename U = Allocator> | |
std::enable_if < traits::has_expand< U > ::value, bool >::type | expand (block &b, size_t delta) noexcept |
bool | owns (const block &b) const noexcept |
template<typename U = Allocator> | |
std::enable_if < traits::has_deallocate_all < U >::value, void >::type | deallocate_all () noexcept |
Static Public Member Functions | |
static constexpr size_t | good_size (size_t n) |
Static Public Attributes | |
static constexpr bool | supports_truncated_deallocation = Allocator::supports_truncated_deallocation |
static constexpr unsigned | alignment = Allocator::alignment |
This implements a cascade of allocators. If the first allocator cannot fulfill the given request, then a next one is created and the requested is passed to it. This class is thread safe as far as not deleteAll is called.
Allocator | of this type Allocators get created. |
Definition at line 29 of file cascading_allocator.hpp.
|
inline |
Frees all allocated memory!
Definition at line 183 of file cascading_allocator.hpp.
|
inlinenoexcept |
Sends the request to the first allocator, if it cannot fulfill the request then the next Allocator is created and so on
Definition at line 192 of file cascading_allocator.hpp.
|
inlinenoexcept |
Frees the given block and resets it
Definition at line 236 of file cascading_allocator.hpp.
|
inlinenoexcept |
Deletes all allocated resources. All Blocks created by this instance must not be used any more. Calling this method while other threads are allocating or deallocating leads to unpredictable behavior. This is only available if the Allocator implements it as well.
Definition at line 315 of file cascading_allocator.hpp.
|
inlinenoexcept |
Tries to expand the given block insito by the specified number of bytes This is only available if the Allocator implements it
b | The block to be expanded |
delta | The amount of bytes |
Definition at line 288 of file cascading_allocator.hpp.
|
inlinenoexcept |
Checks for the ownership of the given block
b | The block to check |
Definition at line 302 of file cascading_allocator.hpp.
|
inlinenoexcept |
Reallocates the given block to the specified size. If the owning allocator cannot fulfill the request then a cross move is performed
b | Block to be reallocated |
n | The new size |
True,if | the operation was successful |
Definition at line 261 of file cascading_allocator.hpp.