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>
53#pragma region Allocation
55 noexcept(detail::has_nothrow_allocate_v<Alloc>)
63 s_Alloc.deallocate(p, n);
67#pragma region Construction
68 template<
typename T,
typename... Args>
73 s_Alloc.construct(p, std::forward<Args>(args)...);
77 typename std::enable_if<detail::has_destroy_v<Alloc, T*>,
void>::type
86 template<
typename A = Alloc>
87 typename std::enable_if<detail::has_max_size_v<A>,
size_type>::type
89 noexcept(detail::has_nothrow_max_size_v<A>)
91 return s_Alloc.max_size();
94 template<
typename A = Alloc>
95 typename std::enable_if<detail::has_owns_v<A>,
bool>::type
99 return s_Alloc.owns(p);
105 s_Alloc = std::move(value);
119 static inline Alloc s_Alloc{};
bool operator==(const global &rhs) const noexcept
Definition global.h:43
const Alloc & get_allocator() const noexcept
Definition global.h:113
global & operator=(global &&rhs) noexcept
Definition global.h:38
std::enable_if< detail::has_owns_v< A >, bool >::type owns(void *p) const noexcept(detail::has_nothrow_owns_v< A >)
Definition global.h:96
detail::get_size_type_t< Alloc > size_type
Definition global.h:22
void set_allocator(Alloc &&value) noexcept
Definition global.h:103
global & operator=(const global &rhs) noexcept
Definition global.h:33
bool operator!=(const global &rhs) const noexcept
Definition global.h:48
global(global &&other) noexcept
Definition global.h:31
std::enable_if< detail::has_destroy_v< Alloc, T * >, void >::type destroy(T *p) noexcept(detail::has_nothrow_destroy_v< Alloc, T * >)
Definition global.h:78
std::enable_if< detail::has_max_size_v< A >, size_type >::type max_size() const noexcept(detail::has_nothrow_max_size_v< A >)
Definition global.h:88
Alloc & get_allocator() noexcept
Definition global.h:108
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 global.h:70
global() noexcept
Constructor for forwarding any arguments to the underlying allocator.
Definition global.h:27
global(const global &other) noexcept
Definition global.h:29
void deallocate(void *p, size_t n) noexcept(detail::has_nothrow_deallocate_v< Alloc >)
Definition global.h:60
void * allocate(size_t n, const source_location source=KTL_SOURCE()) noexcept(detail::has_nothrow_allocate_v< Alloc >)
Definition global.h:54
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