|
Allocator Builder
Policy Based C++ Template Allocator Library
|
#include <segregator.hpp>
Inherits SmallAllocator, and LargeAllocator.
Public Types | |
| using | small_allocator = SmallAllocator |
| using | large_allocator = LargeAllocator |
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 = SmallAllocator, typename V = LargeAllocator> | |
| std::enable_if < traits::has_expand < SmallAllocator >::value||traits::has_expand < LargeAllocator >::value, bool >::type | expand (block &b, size_t delta) noexcept |
| template<typename U = SmallAllocator, typename V = LargeAllocator> | |
| std::enable_if < traits::has_expand < SmallAllocator >::value||traits::has_expand < LargeAllocator >::value, bool >::type | owns (const block &b) const noexcept |
| template<typename U = SmallAllocator, typename V = LargeAllocator> | |
| std::enable_if < traits::has_expand < SmallAllocator >::value||traits::has_expand < LargeAllocator >::value, void >::type | deallocate_all () noexcept |
Static Public Attributes | |
| static constexpr size_t | threshold = Threshold |
| static constexpr bool | supports_truncated_deallocation |
| static constexpr unsigned | alignment |
This allocator separates the allocation requested depending on a threshold between the Small- and the LargeAllocator
| Threshold | The edge until all allocations go to the SmallAllocator |
| SmallAllocator | This gets all allocations below the Threshold |
| LargeAllocator | This gets all allocations starting with the Threshold |
Definition at line 27 of file segregator.hpp.
|
inlinenoexcept |
Allocates the specified number of bytes. If the operation was not successful it returns an empty block.
| n | Number of requested bytes |
Definition at line 53 of file segregator.hpp.
|
inlinenoexcept |
Frees the given block and resets it.
| b | The block to be freed. |
Definition at line 70 of file segregator.hpp.
|
inlinenoexcept |
Deallocates all memory. This is available if one of the allocators implement it.
Definition at line 161 of file segregator.hpp.
|
inlinenoexcept |
The given block will be expanded insito This method is only available if one the Allocators implements it.
| b | The block to be expanded |
| delta | The number of bytes to be expanded |
Definition at line 118 of file segregator.hpp.
|
inlinenoexcept |
Checks the ownership of the given block. This is only available if both Allocator implement it
| b | The block to checked |
Definition at line 146 of file segregator.hpp.
|
static |
Definition at line 42 of file segregator.hpp.
|
static |
Definition at line 38 of file segregator.hpp.