13 #include <type_traits>
16 inline namespace v_100 {
34 template <
class OldAllocator,
class NewAllocator>
38 auto newBlock = newAllocator.allocate(n);
43 oldAllocator.deallocate(b);
57 template <
class Allocator,
typename Enabled =
void>
struct reallocator;
65 template <
class Allocator>
67 typename std::enable_if<traits::has_expand<Allocator>::value>::type> {
68 static bool is_handled_default(Allocator &allocator,
block &b,
size_t n) noexcept
74 allocator.deallocate(b);
78 b = allocator.allocate(n);
82 if (allocator.expand(b, n - b.
length)) {
96 template <
class Allocator>
98 typename std::enable_if<!traits::has_expand<Allocator>::value>::type> {
100 static bool is_handled_default(Allocator &allocator,
block &b,
size_t n) noexcept
106 allocator.deallocate(b);
110 b = allocator.allocate(n);
117 template <
typename Allocator>
118 bool is_reallocation_handled_default(Allocator& allocator,
block& b,
size_t n) noexcept
124 using namespace v_100;
void block_copy(const block &source, block &destination) noexcept
size_t length
This describes the length of the reserved bytes.
bool reallocate_with_copy(OldAllocator &oldAllocator, NewAllocator &newAllocator, block &b, size_t n) noexcept