4#ifndef WPI_MEMORY_STD_ALLOCATOR_HPP_INCLUDED
5#define WPI_MEMORY_STD_ALLOCATOR_HPP_INCLUDED
22 namespace traits_detail
24 template <
class RawAllocator>
26 typename RawAllocator::propagate_on_container_swap;
28 template <
class RawAllocator>
31 template <
class RawAllocator>
33 typename RawAllocator::propagate_on_container_move_assignment;
35 template <
class RawAllocator>
38 template <
class RawAllocator>
40 typename RawAllocator::propagate_on_container_copy_assignment;
42 template <
class RawAllocator>
48 template <
class RawAllocator>
63 template <
class AllocReference>
73 template <
typename T,
class RawAllocator>
75#if defined _MSC_VER && defined __clang__
76 WPI_EBO(protected allocator_reference<RawAllocator>)
78 WPI_EBO(allocator_reference<RawAllocator>)
83 using is_any = std::is_same<alloc_reference, any_allocator_reference>;
103 template <
typename U>
116#if !defined(__GNUC__) || (defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI != 0)
119 static_assert(!alloc_reference::is_stateful::value,
120 "default constructor must not be used for stateful allocators");
135 WPI_REQUIRES((!std::is_base_of<std_allocator, RawAlloc>::value))>
151 WPI_REQUIRES((!std::is_base_of<std_allocator, RawAlloc>::value))>
153 std::declval<const RawAlloc&>()))) noexcept
163 template <
class StoragePolicy,
class OtherMut>
169 template <
typename U>
175 template <
typename U>
196 return static_cast<pointer>(allocate_impl(is_any{}, n));
204 deallocate_impl(is_any{}, p, n);
209 template <
typename U,
typename... Args>
217 template <
typename U>
230 return this->max_array_size() /
sizeof(
value_type);
252 void* allocate_impl(std::true_type,
size_type n)
254 return get_allocator().allocate_impl(n,
sizeof(T),
alignof(T));
257 void deallocate_impl(std::true_type,
void*
ptr,
size_type n)
263 void* allocate_impl(std::false_type,
size_type n)
266 return this->allocate_node(
sizeof(T),
alignof(T));
268 return this->allocate_array(n,
sizeof(T),
alignof(T));
271 void deallocate_impl(std::false_type,
void*
ptr,
size_type n)
279 template <
typename U>
280 bool equal_to_impl(std::true_type,
286 template <
typename U>
287 bool equal_to_impl(std::false_type,
293 template <
typename U>
294 bool equal_to(std::true_type,
300 template <
typename U>
301 bool equal_to(std::false_type,
307 template <
typename T1,
typename T2,
class Impl>
311 template <
typename U,
class OtherRawAllocator>
318 template <
typename T,
typename U,
class Impl>
328 template <
typename T,
typename U,
class Impl>
332 return !(lhs == rhs);
337 template <
typename T,
class RawAllocator>
348 template <
typename T>
353 template <
typename T,
class RawAllocator>
Class template wpi::memory::allocator_storage, some policies and resulting typedefs.
An alias template for allocator_storage using the reference_storage policy.
Definition allocator_storage.hpp:900
A RawAllocator that stores another allocator.
Definition allocator_storage.hpp:97
typename reference_storage< RawAllocator >::allocator_type allocator_type
Definition allocator_storage.hpp:106
auto get_allocator() noexcept -> decltype(std::declval< storage_policy >().get_allocator())
Definition allocator_storage.hpp:277
decltype(traits_detail::is_stateful< Allocator >(traits_detail::full_concept{})) is_stateful
Definition allocator_traits.hpp:295
An alias template for std_allocator using a type-erased RawAllocator.
Definition std_allocator.hpp:349
any_std_allocator< T > make_any_std_allocator(RawAllocator &&allocator) noexcept
Definition std_allocator.hpp:354
Wraps a RawAllocator and makes it a "normal" Allocator.
Definition std_allocator.hpp:80
void deallocate(pointer p, size_type n) noexcept
Definition std_allocator.hpp:202
T value_type
Definition std_allocator.hpp:89
auto get_allocator() noexcept -> decltype(std::declval< alloc_reference >().get_allocator())
Definition std_allocator.hpp:237
std::ptrdiff_t difference_type
Definition std_allocator.hpp:95
std_allocator() noexcept
Definition std_allocator.hpp:114
const T * const_pointer
Definition std_allocator.hpp:91
typename prop_traits::propagate_on_container_copy_assignment propagate_on_container_copy_assignment
Definition std_allocator.hpp:100
void construct(U *p, Args &&... args)
Definition std_allocator.hpp:210
std_allocator(const RawAlloc &alloc,) noexcept
Definition std_allocator.hpp:152
std_allocator(const allocator_storage< StoragePolicy, OtherMut > &)=delete
auto get_allocator() const noexcept -> decltype(std::declval< const alloc_reference >().get_allocator())
Definition std_allocator.hpp:243
friend class std_allocator
Definition std_allocator.hpp:312
typename prop_traits::propagate_on_container_move_assignment propagate_on_container_move_assignment
Definition std_allocator.hpp:98
std_allocator(const std_allocator< U, RawAllocator > &alloc) noexcept
Definition std_allocator.hpp:170
std_allocator(RawAlloc &alloc,) noexcept
Definition std_allocator.hpp:136
size_type max_size() const noexcept
Definition std_allocator.hpp:228
typename prop_traits::propagate_on_container_swap propagate_on_container_swap
Definition std_allocator.hpp:97
std_allocator(std_allocator< U, RawAllocator > &alloc) noexcept
Definition std_allocator.hpp:176
void destroy(U *p) noexcept
Definition std_allocator.hpp:218
std_allocator< T, RawAllocator > select_on_container_copy_construction() const
Definition std_allocator.hpp:183
std_allocator(const alloc_reference &alloc) noexcept
Definition std_allocator.hpp:159
const T & const_reference
Definition std_allocator.hpp:93
T & reference
Definition std_allocator.hpp:92
T * pointer
Definition std_allocator.hpp:90
bool operator==(const std_allocator< T, Impl > &lhs, const std_allocator< U, Impl > &rhs) noexcept
Definition std_allocator.hpp:319
auto make_std_allocator(RawAllocator &&allocator) noexcept -> std_allocator< T, typename std::decay< RawAllocator >::type >
Definition std_allocator.hpp:338
bool operator!=(const std_allocator< T, Impl > &lhs, const std_allocator< U, Impl > &rhs) noexcept
Definition std_allocator.hpp:329
std::size_t size_type
Definition std_allocator.hpp:94
friend bool operator==(const std_allocator< T1, Impl > &lhs, const std_allocator< T2, Impl > &rhs) noexcept
pointer allocate(size_type n, void *=nullptr)
Definition std_allocator.hpp:194
typename alloc_reference::allocator_type allocator_type
Definition std_allocator.hpp:109
#define WPI_ALIAS_TEMPLATE(Name,...)
Definition config.hpp:73
Implement std::hash so that hash_code can be used in STL containers.
Definition PointerIntPair.h:280
T && forward(typename std::remove_reference< T >::type &t) noexcept
Definition utility.hpp:31
auto propagate_on_container_copy_assignment(std_concept) -> typename RawAllocator::propagate_on_container_copy_assignment
auto propagate_on_container_swap(std_concept) -> typename RawAllocator::propagate_on_container_swap
auto propagate_on_container_move_assignment(std_concept) -> typename RawAllocator::propagate_on_container_move_assignment
auto deallocate_array(full_concept, Allocator &alloc, void *ptr, std::size_t count, std::size_t size, std::size_t alignment) noexcept -> WPI_AUTO_RETURN_TYPE(alloc.deallocate_array(ptr, count, size, alignment), void) template< class Allocator > void deallocate_array(min_concept, Allocator &alloc, void *ptr, std::size_t count, std::size_t size, std::size_t alignment) noexcept
Definition allocator_traits.hpp:233
auto deallocate_node(full_concept, Allocator &alloc, void *ptr, std::size_t size, std::size_t alignment) noexcept -> WPI_AUTO_RETURN_TYPE(alloc.deallocate_node(ptr, size, alignment), void) template< class Allocator > auto deallocate_node(std_concept, Allocator &alloc, void *ptr, std::size_t size, std::size_t) noexcept -> WPI_AUTO_RETURN_TYPE(alloc.deallocate(static_cast< char * >(ptr), size), void) template< class Allocator > error deallocate_node(error, Allocator &, void *, std::size_t, std::size_t)
Definition allocator_traits.hpp:195
Memory namespace.
Definition heap_allocator.hpp:20
Foonathan namespace.
Definition ntcore_cpp.h:26
Specifies whether or not a RawAllocator has shared semantics.
Definition allocator_storage.hpp:534
Controls the propagation of a std_allocator for a certain RawAllocator.
Definition std_allocator.hpp:50
static AllocReference select_on_container_copy_construction(const AllocReference &alloc)
Definition std_allocator.hpp:64
decltype(traits_detail::propagate_on_container_copy_assignment< RawAllocator >( traits_detail::full_concept{})) propagate_on_container_copy_assignment
Definition std_allocator.hpp:59
decltype(traits_detail::propagate_on_container_move_assignment< RawAllocator >( traits_detail::full_concept{})) propagate_on_container_move_assignment
Definition std_allocator.hpp:55
decltype(traits_detail::propagate_on_container_swap< RawAllocator >( traits_detail::full_concept{})) propagate_on_container_swap
Definition std_allocator.hpp:51
Definition std_allocator.hpp:105
Definition allocator_traits.hpp:91
Definition allocator_traits.hpp:88
Definition allocator_traits.hpp:85
#define WPI_SFINAE(Expr)
Definition utility.hpp:85
#define WPI_REQUIRES(Expr)
Definition utility.hpp:70