22 void (*
request)(
void *, std::size_t) =
nullptr;
23 void *(*allocate)(
void *, std::size_t, std::size_t) =
nullptr;
24 void (*
deallocate)(
void *,
void *, std::size_t, std::size_t) =
nullptr;
55 if (count > std::numeric_limits<std::size_t>::max() /
sizeof(T))
56 return std::allocator<T>{}.allocate(count);
57 const auto bytes = count *
sizeof(T);
62 return static_cast<T *
>(account_->
allocate(account_->
context, bytes,
alignof(T)));
67 if constexpr (
alignof(T) >
alignof(std::max_align_t))
68 return static_cast<T *
>(::operator
new(bytes, std::align_val_t{
alignof(T)}));
70 return static_cast<T *
>(::operator
new(bytes));
79 if constexpr (
alignof(T) >
alignof(std::max_align_t))
80 ::operator
delete(pointer, std::align_val_t{
alignof(T)});
82 ::operator
delete(pointer);
88 return account_ == other.account();
std::true_type propagate_on_container_swap
std::false_type is_always_equal
void deallocate(T *pointer, std::size_t count) noexcept
T * allocate(std::size_t count)
std::true_type propagate_on_container_move_assignment
AccountedAllocator() noexcept=default
bool operator==(const AccountedAllocator< U > &other) const noexcept
AccountedAllocator(const AccountedAllocator< U > &other) noexcept
const AllocationAccount * account() const noexcept
void(* deallocate)(void *, void *, std::size_t, std::size_t)
void(* request)(void *, std::size_t)
void charge(std::size_t bytes) const
void *(* allocate)(void *, std::size_t, std::size_t)