3#include "../utility/aligned_malloc.h"
4#include "../utility/alignment.h"
5#include "../utility/empty_base.h"
6#include "../utility/meta.h"
7#include "../utility/source_location.h"
15 template<
typename Alloc>
31 m_Alloc(other.m_Alloc) {}
34 m_Alloc(other.m_Alloc) {}
38 m_Alloc = rhs.m_Alloc;
45 m_Alloc = rhs.m_Alloc;
53 return m_Alloc == rhs.m_Alloc && *m_Alloc == *rhs.m_Alloc;
59 return m_Alloc != rhs.m_Alloc || *m_Alloc != *rhs.m_Alloc;
62#pragma region Allocation
64 noexcept(detail::has_nothrow_allocate_v<Alloc>)
72 m_Alloc->deallocate(p, n);
76#pragma region Construction
77 template<
typename T,
typename... Args>
82 m_Alloc->construct(p, std::forward<Args>(args)...);
86 typename std::enable_if<detail::has_destroy_v<Alloc, T*>,
void>::type
95 template<
typename A = Alloc>
96 typename std::enable_if<detail::has_max_size_v<A>,
size_type>::type
98 noexcept(detail::has_nothrow_max_size_v<A>)
100 return m_Alloc->max_size();
103 template<
typename A = Alloc>
104 typename std::enable_if<detail::has_owns_v<A>,
bool>::type
108 return m_Alloc->owns(p);
Definition reference.h:17
void deallocate(void *p, size_t n) noexcept(detail::has_nothrow_deallocate_v< Alloc >)
Definition reference.h:69
detail::get_size_type_t< Alloc > size_type
Definition reference.h:22
Alloc & get_allocator() noexcept
Definition reference.h:112
const Alloc & get_allocator() const noexcept
Definition reference.h:117
void * allocate(size_t n, const source_location source=KTL_SOURCE()) noexcept(detail::has_nothrow_allocate_v< Alloc >)
Definition reference.h:63
std::enable_if< detail::has_destroy_v< Alloc, T * >, void >::type destroy(T *p) noexcept(detail::has_nothrow_destroy_v< Alloc, T * >)
Definition reference.h:87
bool operator==(const reference &rhs) const noexcept(detail::has_nothrow_equal_v< Alloc >)
Definition reference.h:50
bool operator!=(const reference &rhs) const noexcept(detail::has_nothrow_not_equal_v< Alloc >)
Definition reference.h:56
reference & operator=(reference &&rhs) noexcept
Definition reference.h:43
reference(Alloc &alloc) noexcept
Constructor for forwarding any arguments to the underlying allocator.
Definition reference.h:27
reference(const reference &other) noexcept
Definition reference.h:30
reference(reference &&other) noexcept
Definition reference.h:33
reference & operator=(const reference &rhs) noexcept
Definition reference.h:36
std::enable_if< detail::has_construct_v< Alloc, T *, Args... >, void >::type construct(T *p, Args &&... args) noexcept(detail::has_nothrow_construct_v< Alloc, T *, Args... >)
Definition reference.h:79
std::enable_if< detail::has_owns_v< A >, bool >::type owns(void *p) const noexcept(detail::has_nothrow_owns_v< A >)
Definition reference.h:105
std::enable_if< detail::has_max_size_v< A >, size_type >::type max_size() const noexcept(detail::has_nothrow_max_size_v< A >)
Definition reference.h:97
typename get_size_type< Alloc, void >::type get_size_type_t
Definition meta.h:33
constexpr bool has_nothrow_construct_v
Definition meta.h:123
constexpr bool has_construct_v
Definition meta.h:53
void * allocate(Alloc &alloc, size_t n, const source_location source) noexcept(false)
Definition meta.h:161
constexpr bool has_no_value_type_v
Definition meta.h:17
Definition cascading.h:16
#define KTL_SOURCE()
Definition source_location.h:11
Definition source_location.h:19