4#ifndef WPI_MEMORY_ALIGNED_ALLOCATOR_HPP_INCLUDED
5#define WPI_MEMORY_ALIGNED_ALLOCATOR_HPP_INCLUDED
24 template <
class RawAllocator>
54 min_alignment_ = other.min_alignment_;
64 if (min_alignment_ > alignment)
65 alignment = min_alignment_;
69 void*
allocate_array(std::size_t count, std::size_t size, std::size_t alignment)
71 if (min_alignment_ > alignment)
72 alignment = min_alignment_;
78 if (min_alignment_ > alignment)
79 alignment = min_alignment_;
84 std::size_t alignment)
noexcept
86 if (min_alignment_ > alignment)
87 alignment = min_alignment_;
99 if (min_alignment_ > alignment)
100 alignment = min_alignment_;
106 std::
size_t alignment) noexcept
108 if (min_alignment_ > alignment)
109 alignment = min_alignment_;
117 if (min_alignment_ > alignment)
118 alignment = min_alignment_;
125 std::
size_t alignment) noexcept
127 if (min_alignment_ > alignment)
128 alignment = min_alignment_;
168 return min_alignment_;
180 std::size_t min_alignment_;
185 template <
class RawAllocator>
190 typename std::decay<RawAllocator>::type>{min_alignment,
The default specialization of the wpi::memory::allocator_traits.
A RawAllocator adapter that ensures a minimum alignment.
Definition aligned_allocator.hpp:26
void set_min_alignment(std::size_t min_alignment)
Definition aligned_allocator.hpp:173
std::size_t max_node_size() const
Definition aligned_allocator.hpp:136
void deallocate_node(void *ptr, std::size_t size, std::size_t alignment) noexcept
Definition aligned_allocator.hpp:76
auto make_aligned_allocator(std::size_t min_alignment, RawAllocator &&allocator) noexcept -> aligned_allocator< typename std::decay< RawAllocator >::type >
Definition aligned_allocator.hpp:186
aligned_allocator & operator=(aligned_allocator &&other) noexcept
Definition aligned_allocator.hpp:51
bool try_deallocate_node(void *ptr, std::size_t size, std::size_t alignment) noexcept
Definition aligned_allocator.hpp:115
void * allocate_node(std::size_t size, std::size_t alignment)
Definition aligned_allocator.hpp:62
aligned_allocator(aligned_allocator &&other) noexcept
Definition aligned_allocator.hpp:46
typename allocator_traits< RawAllocator >::allocator_type allocator_type
Definition aligned_allocator.hpp:32
std::size_t min_alignment() const noexcept
Definition aligned_allocator.hpp:166
std::true_type is_stateful
Definition aligned_allocator.hpp:33
void * allocate_array(std::size_t count, std::size_t size, std::size_t alignment)
Definition aligned_allocator.hpp:69
allocator_type & get_allocator() noexcept
Definition aligned_allocator.hpp:154
void * try_allocate_node(std::size_t size, std::size_t alignment) noexcept
Definition aligned_allocator.hpp:97
void deallocate_array(void *ptr, std::size_t count, std::size_t size, std::size_t alignment) noexcept
Definition aligned_allocator.hpp:83
void * try_allocate_array(std::size_t count, std::size_t size, std::size_t alignment) noexcept
Definition aligned_allocator.hpp:105
const allocator_type & get_allocator() const noexcept
Definition aligned_allocator.hpp:159
std::size_t max_alignment() const
Definition aligned_allocator.hpp:146
aligned_allocator(std::size_t min_alignment, allocator_type &&alloc={})
Definition aligned_allocator.hpp:37
bool try_deallocate_array(void *ptr, std::size_t count, std::size_t size, std::size_t alignment) noexcept
Definition aligned_allocator.hpp:124
std::size_t max_array_size() const
Definition aligned_allocator.hpp:141
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
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
T && forward(typename std::remove_reference< T >::type &t) noexcept
Definition utility.hpp:31
std::remove_reference< T >::type && move(T &&arg) noexcept
Definition utility.hpp:25
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
#define WPI_MEMORY_ASSERT(Expr)
Definition assert.hpp:46