4#ifndef WPI_MEMORY_FALLBACK_ALLOCATOR_HPP_INCLUDED
5#define WPI_MEMORY_FALLBACK_ALLOCATOR_HPP_INCLUDED
25 template <
class Default,
class Fallback>
27 : WPI_EBO(detail::ebo_storage<0, typename allocator_traits<Default>::allocator_type>),
28 WPI_EBO(detail::ebo_storage<1, typename allocator_traits<Fallback>::allocator_type>)
42 std::integral_constant<bool, default_traits::is_stateful::value
43 || fallback_traits::is_stateful::value>;
74 void*
allocate_array(std::size_t count, std::size_t size, std::size_t alignment)
77 count, size, alignment);
87 ptr, size, alignment);
94 std::size_t alignment)
noexcept
98 count, size, alignment);
122 std::
size_t alignment) noexcept
125 count, size, alignment);
128 count, size, alignment);
136 ptr, size, alignment);
139 ptr, size, alignment);
145 std::
size_t alignment) noexcept
149 count, size, alignment);
164 return fallback > def ? fallback : def;
171 return fallback > def ? fallback : def;
178 return fallback > def ? fallback : def;
The default specialization of the wpi::memory::allocator_traits.
The default specialization of the allocator_traits for a RawAllocator.
Definition allocator_traits.hpp:292
static void deallocate_array(allocator_type &state, void *array, std::size_t count, std::size_t size, std::size_t alignment) noexcept
Definition allocator_traits.hpp:328
traits_detail::allocator_type< Allocator > allocator_type
Definition allocator_traits.hpp:294
static void * allocate_array(allocator_type &state, std::size_t count, std::size_t size, std::size_t alignment)
Definition allocator_traits.hpp:308
static std::size_t max_array_size(const allocator_type &state)
Definition allocator_traits.hpp:346
static std::size_t max_node_size(const allocator_type &state)
Definition allocator_traits.hpp:338
static std::size_t max_alignment(const allocator_type &state)
Definition allocator_traits.hpp:354
static void * allocate_node(allocator_type &state, std::size_t size, std::size_t alignment)
Definition allocator_traits.hpp:298
static void deallocate_node(allocator_type &state, void *node, std::size_t size, std::size_t alignment) noexcept
Definition allocator_traits.hpp:318
The default specialization of the composable_allocator_traits for a ComposableAllocator.
Definition allocator_traits.hpp:500
static void * try_allocate_node(allocator_type &state, std::size_t size, std::size_t alignment) noexcept
Definition allocator_traits.hpp:504
static void * try_allocate_array(allocator_type &state, std::size_t count, std::size_t size, std::size_t alignment) noexcept
Definition allocator_traits.hpp:513
static bool try_deallocate_node(allocator_type &state, void *node, std::size_t size, std::size_t alignment) noexcept
Definition allocator_traits.hpp:522
static bool try_deallocate_array(allocator_type &state, void *array, std::size_t count, std::size_t size, std::size_t alignment) noexcept
Definition allocator_traits.hpp:531
Definition ebo_storage.hpp:18
T & get() noexcept
Definition ebo_storage.hpp:27
A RawAllocator with a fallback.
Definition fallback_allocator.hpp:29
default_allocator_type & get_default_allocator() noexcept
Definition fallback_allocator.hpp:184
const fallback_allocator_type & get_fallback_allocator() const noexcept
Definition fallback_allocator.hpp:202
std::size_t max_node_size() const
Definition fallback_allocator.hpp:160
void * try_allocate_node(std::size_t size, std::size_t alignment) noexcept
Definition fallback_allocator.hpp:110
fallback_allocator_type & get_fallback_allocator() noexcept
Definition fallback_allocator.hpp:197
typename allocator_traits< Default >::allocator_type default_allocator_type
Definition fallback_allocator.hpp:38
std::integral_constant< bool, default_traits::is_stateful::value||fallback_traits::is_stateful::value > is_stateful
Definition fallback_allocator.hpp:41
typename allocator_traits< Fallback >::allocator_type fallback_allocator_type
Definition fallback_allocator.hpp:39
void * allocate_array(std::size_t count, std::size_t size, std::size_t alignment)
Definition fallback_allocator.hpp:74
void deallocate_node(void *ptr, std::size_t size, std::size_t alignment) noexcept
Definition fallback_allocator.hpp:84
bool try_deallocate_array(void *ptr, std::size_t count, std::size_t size, std::size_t alignment) noexcept
Definition fallback_allocator.hpp:144
void * allocate_node(std::size_t size, std::size_t alignment)
Definition fallback_allocator.hpp:65
bool try_deallocate_node(void *ptr, std::size_t size, std::size_t alignment) noexcept
Definition fallback_allocator.hpp:133
void deallocate_array(void *ptr, std::size_t count, std::size_t size, std::size_t alignment) noexcept
Definition fallback_allocator.hpp:93
std::size_t max_array_size() const
Definition fallback_allocator.hpp:167
const default_allocator_type & get_default_allocator() const noexcept
Definition fallback_allocator.hpp:189
std::size_t max_alignment() const
Definition fallback_allocator.hpp:174
fallback_allocator(default_allocator_type &&default_alloc, fallback_allocator_type &&fallback_alloc={})
Definition fallback_allocator.hpp:55
detail namespace with internal helper functions
Definition input_adapters.h:32
Implement std::hash so that hash_code can be used in STL containers.
Definition PointerIntPair.h:280
Memory namespace.
Definition heap_allocator.hpp:20
Foonathan namespace.
Definition ntcore_cpp.h:26
Traits that check whether a type models concept ComposableAllocator.
Definition allocator_traits.hpp:596
#define WPI_ENABLE_IF(Expr)
Definition utility.hpp:78