Allocator Builder
Policy Based C++ Template Allocator Library
|
#include <fallback_allocator.hpp>
Inherits Primary, and Fallback.
Public Member Functions | |
block | allocate (size_t n) noexcept |
void | deallocate (block &b) noexcept |
bool | reallocate (block &b, size_t n) noexcept |
template<typename U = Primary, typename V = Fallback> | |
std::enable_if < traits::has_expand< U > ::value||traits::has_expand< V > ::value, bool >::type | expand (block &b, size_t delta) noexcept |
template<typename U = Primary, typename V = Fallback> | |
std::enable_if < traits::has_owns< U >::value &&traits::has_owns< V >::value, bool >::type | owns (const block &b) const noexcept |
template<typename U = Primary, typename V = Fallback> | |
std::enable_if < traits::has_deallocate_all < U >::value &&traits::has_deallocate_all < V >::value, void >::type | deallocate_all () noexcept |
Static Public Attributes | |
static constexpr bool | supports_truncated_deallocation |
static constexpr unsigned | alignment |
All allocation requests are passed to the Primary allocator. Only if this cannot fulfill the request, it is passed to the Fallback allocator
Primary | The allocator that gets all requests by default |
Fallback | The allocator that get the requests, if the Primary failed. |
Definition at line 26 of file fallback_allocator.hpp.
|
inlinenoexcept |
Allocates the requested number of bytes.
n | The number of bytes. Depending on the alignment of the allocator, the block might contain a bigger size |
Definition at line 46 of file fallback_allocator.hpp.
|
inlinenoexcept |
Frees the memory of the provided block and resets it.
b | The block describing the memory to be freed. |
Definition at line 62 of file fallback_allocator.hpp.
|
inlinenoexcept |
Expands the given block by the given amount of bytes. This method is only available if at least one of the allocators implements it
b | The block that should be expanded |
delta | The number of bytes that should be appended |
Definition at line 114 of file fallback_allocator.hpp.
|
inlinenoexcept |
Checks for the ownership of the given block This method is only available, if both allocators implements it.
b | The block which ownership shall be checked. |
Definition at line 135 of file fallback_allocator.hpp.
|
inlinenoexcept |
Reallocates the given block to the given size. If the Primary cannot handle the request, then a memory move is done.
b | The block to be reallocated |
n | The new size (Zero means deallocation.) |
Definition at line 80 of file fallback_allocator.hpp.
|
static |
Definition at line 38 of file fallback_allocator.hpp.
|
static |
Definition at line 35 of file fallback_allocator.hpp.