12 #include "allocator_base.hpp"
13 #include "internal/reallocator.hpp"
16 inline namespace v_100 {
25 template <
class Primary,
class Fallback>
28 using primary = Primary;
29 using fallback = Fallback;
32 "Primary- and Fallback-Allocator cannot be both of the same base!");
35 static constexpr
bool supports_truncated_deallocation = Primary::supports_truncated_deallocation ||
36 Fallback::supports_truncated_deallocation;
38 static constexpr
unsigned alignment = (Primary::alignment > Fallback::alignment) ?
39 Primary::alignment : Fallback::alignment;
51 result = Primary::allocate(n);
53 result = Fallback::allocate(n);
68 Primary::deallocate(b);
70 Fallback::deallocate(b);
81 if (Primary::owns(b)) {
82 if (internal::is_reallocation_handled_default(static_cast<Primary &>(*
this), b, n)) {
87 if (internal::is_reallocation_handled_default(static_cast<Fallback &>(*
this), b,
93 if (Primary::owns(b)) {
94 if (Primary::reallocate(b, n)) {
98 static_cast<Fallback &>(*
this), b, n);
101 return Fallback::reallocate(b, n);
112 template <
typename U = Primary,
typename V = Fallback>
115 if (Primary::owns(b)) {
133 template <
typename U = Primary,
typename V = Fallback>
136 return Primary::owns(b) || Fallback::owns(b);
139 template <
typename U = Primary,
typename V = Fallback>
140 typename std::enable_if<traits::has_deallocate_all<U>::value &&
142 deallocate_all() noexcept {
143 Primary::deallocate_all();
144 Fallback::deallocate_all();
149 using namespace v_100;
std::enable_if< traits::has_owns< U >::value &&traits::has_owns< V >::value, bool >::type owns(const block &b) const noexcept
bool reallocate(block &b, size_t n) noexcept
std::enable_if< traits::has_expand< U >::value||traits::has_expand< V >::value, bool >::type expand(block &b, size_t delta) noexcept
void deallocate(block &b) noexcept
bool reallocate_with_copy(OldAllocator &oldAllocator, NewAllocator &newAllocator, block &b, size_t n) noexcept
block allocate(size_t n) noexcept