35 return static_cast<T*
>(
operator new(
n *
sizeof(
T)));
68template <
typename Alloc>
84 template <
typename T,
typename...
Args>
87 if constexpr (
requires {
106 template <
typename T>
109 if constexpr (
requires {
alloc.destroy(
ptr); }) {
124 template <
typename T>
139 template <
typename T>
Unifined interface for allocators.
Definition allocator.h:69
Alloc allocator_type
Definition allocator.h:71
static void deallocate(Alloc &alloc, T *ptr, size_t n)
Deallocates memory under ptr through allocator.
Definition allocator.h:140
static void destroy(Alloc &alloc, T *ptr)
Destroys object throgh alloctor if destroy method is present. Otherwise calls ~T()
Definition allocator.h:107
static void construct(Alloc &alloc, T *ptr, Args &&... args)
Forwards given arguments to allocator's construct method if present. Otherwise uses placement new.
Definition allocator.h:85
static T * allocate(Alloc &alloc, size_t n)
Allocates given number of objects using allocator.
Definition allocator.h:126
Allocator-proxy for new/delete operators.
Definition allocator.h:22
void deallocate(T *ptr, size_t) noexcept
Deallocates memory under ptr.
Definition allocator.h:52
bool operator==(const PrimitiveAllocator &) const
Definition allocator.h:56
T * allocate(size_t n)
Allocates raw memory for n objects of type T.
Definition allocator.h:34
Definition algo_base.h:14
constexpr T && forward(remove_ref_t< T > &value) noexcept
Forward a lvalue.
Definition move.h:33