4#ifndef WPI_MEMORY_CONTAINER_HPP_INCLUDED
5#define WPI_MEMORY_CONTAINER_HPP_INCLUDED
12#if !WPI_HOSTED_IMPLEMENTATION
13#error "This header is only available for a hosted implementation."
20#include <forward_list>
24#include <scoped_allocator>
28#include <unordered_map>
29#include <unordered_set>
45 template <
typename T,
class RawAllocator>
50 template <
typename T,
class RawAllocator>
56 template <
typename T,
class RawAllocator>
59 template <
typename T,
class RawAllocator>
65 template <
typename T,
class RawAllocator>
68 template <
typename T,
class RawAllocator>
74 template <
typename T,
class RawAllocator>
78 template <
typename T,
class RawAllocator>
84 template <
typename T,
class RawAllocator>
87 template <
typename T,
class RawAllocator>
90 std::set<T, std::less<T>,
94 template <
typename T,
class RawAllocator>
98 template <
typename T,
class RawAllocator>
101 std::multiset<T, std::less<T>,
105 template <
typename Key,
typename Value,
class RawAllocator>
107 map, std::map<Key, Value, std::less<Key>,
110 template <
typename Key,
typename Value,
class RawAllocator>
113 std::map<Key, Value, std::less<Key>,
114 std::scoped_allocator_adaptor<
118 template <
typename Key,
typename Value,
class RawAllocator>
120 multimap, std::multimap<Key, Value, std::less<Key>,
123 template <
typename Key,
typename Value,
class RawAllocator>
126 std::multimap<Key, Value, std::less<Key>,
127 std::scoped_allocator_adaptor<
131 template <
typename T,
class RawAllocator>
136 template <
typename T,
class RawAllocator>
139 std::unordered_set<T, std::hash<T>, std::equal_to<T>,
143 template <
typename T,
class RawAllocator>
145 std::unordered_multiset<T, std::hash<T>, std::equal_to<T>,
148 template <
typename T,
class RawAllocator>
151 std::unordered_multiset<T, std::hash<T>, std::equal_to<T>,
155 template <
typename Key,
typename Value,
class RawAllocator>
158 std::unordered_map<Key, Value, std::hash<Key>, std::equal_to<Key>,
161 template <
typename Key,
typename Value,
class RawAllocator>
164 std::unordered_map<Key, Value, std::hash<Key>, std::equal_to<Key>,
165 std::scoped_allocator_adaptor<
169 template <
typename Key,
typename Value,
class RawAllocator>
172 std::unordered_multimap<Key, Value, std::hash<Key>, std::equal_to<Key>,
175 template <
typename Key,
typename Value,
class RawAllocator>
178 std::unordered_multimap<Key, Value, std::hash<Key>, std::equal_to<Key>,
179 std::scoped_allocator_adaptor<
183 template <
typename T,
class RawAllocator>
186 template <
typename T,
class RawAllocator>
191 template <
typename T,
class RawAllocator>
194 template <
typename T,
class RawAllocator>
199 template <
typename T,
class RawAllocator>
202 template <
typename T,
class RawAllocator>
207 template <
class RawAllocator>
217 template <
typename T,
class RawAllocator,
class Container = deque<T, RawAllocator>>
220 return std::stack<T, Container>{Container(allocator)};
224 template <
typename T,
class RawAllocator,
class Container = deque<T, RawAllocator>>
227 return std::queue<T, Container>{Container(allocator)};
231 template <
typename T,
class RawAllocator,
class Container = deque<T, RawAllocator>,
232 class Compare = std::less<T>>
236 return std::priority_queue<T, Container, Compare>{
detail::move(comp),
237 Container(allocator)};
245#if !defined(WPI_MEMORY_NO_NODE_SIZE)
249 template <
typename T,
class StdAllocator>
250 struct shared_ptr_node_size
252 static_assert(
sizeof(T) !=
sizeof(T),
"unsupported allocator type");
255 template <
typename T,
class RawAllocator>
256 struct shared_ptr_node_size<T, std_allocator<T, RawAllocator>>
257 : std::conditional<allocator_traits<RawAllocator>::is_stateful::value,
258 memory::shared_ptr_stateful_node_size<T>,
259 memory::shared_ptr_stateless_node_size<T>>::type
261 static_assert(
sizeof(std_allocator<T, RawAllocator>) <=
sizeof(
void*),
262 "fix node size debugger");
267 template <
typename T,
class StdAllocator>
268 struct shared_ptr_node_size : detail::shared_ptr_node_size<T, StdAllocator>
281 template <
typename T>
287 template <
typename T>
288 struct list_node_size : std::integral_constant<std::size_t, implementation_defined>
293 template <
typename T>
294 struct set_node_size : std::integral_constant<std::size_t, implementation_defined>
299 template <
typename T>
305 template <
typename T>
311 template <
typename T>
313 : std::integral_constant<std::size_t, implementation_defined>
323 template <
typename T>
324 struct map_node_size : std::integral_constant<std::size_t, implementation_defined>
329 template <
typename T>
335 template <
typename T>
341 template <
typename T>
343 : std::integral_constant<std::size_t, implementation_defined>
348 template <
typename T,
class StdAllocator>
355#if !defined(WPI_MEMORY_NO_NODE_SIZE)
359 template <
typename T,
class RawAllocator>
Same as above but uses std::scoped_allocator_adaptor so the allocator is inherited by all nested cont...
Definition container.hpp:62
Alias template for an STL container that uses a certain RawAllocator.
Definition container.hpp:57
Same as above but uses std::scoped_allocator_adaptor so the allocator is inherited by all nested cont...
Definition container.hpp:81
Alias template for an STL container that uses a certain RawAllocator.
Definition container.hpp:76
Same as above but uses std::scoped_allocator_adaptor so the allocator is inherited by all nested cont...
Definition container.hpp:71
Alias template for an STL container that uses a certain RawAllocator.
Definition container.hpp:66
Same as above but uses std::scoped_allocator_adaptor so the allocator is inherited by all nested cont...
Definition container.hpp:115
Alias template for an STL container that uses a certain RawAllocator.
Definition container.hpp:108
Same as above but uses std::scoped_allocator_adaptor so the allocator is inherited by all nested cont...
Definition container.hpp:128
Alias template for an STL container that uses a certain RawAllocator.
Definition container.hpp:121
Same as above but uses std::scoped_allocator_adaptor so the allocator is inherited by all nested cont...
Definition container.hpp:102
Alias template for an STL container that uses a certain RawAllocator.
Definition container.hpp:96
Same as above but uses std::scoped_allocator_adaptor so the allocator is inherited by all nested cont...
Definition container.hpp:204
Alias template for an STL container that uses a certain RawAllocator.
Definition container.hpp:200
Same as above but uses std::scoped_allocator_adaptor so the allocator is inherited by all nested cont...
Definition container.hpp:196
Alias template for an STL container that uses a certain RawAllocator.
Definition container.hpp:192
Same as above but uses std::scoped_allocator_adaptor so the allocator is inherited by all nested cont...
Definition container.hpp:91
Alias template for an STL container that uses a certain RawAllocator.
Definition container.hpp:85
Same as above but uses std::scoped_allocator_adaptor so the allocator is inherited by all nested cont...
Definition container.hpp:188
Alias template for an STL container that uses a certain RawAllocator.
Definition container.hpp:184
Wraps a RawAllocator and makes it a "normal" Allocator.
Definition std_allocator.hpp:80
Same as above but uses std::scoped_allocator_adaptor so the allocator is inherited by all nested cont...
Definition container.hpp:166
Alias template for an STL container that uses a certain RawAllocator.
Definition container.hpp:159
Same as above but uses std::scoped_allocator_adaptor so the allocator is inherited by all nested cont...
Definition container.hpp:180
Alias template for an STL container that uses a certain RawAllocator.
Definition container.hpp:173
Same as above but uses std::scoped_allocator_adaptor so the allocator is inherited by all nested cont...
Definition container.hpp:152
Alias template for an STL container that uses a certain RawAllocator.
Definition container.hpp:146
Same as above but uses std::scoped_allocator_adaptor so the allocator is inherited by all nested cont...
Definition container.hpp:140
Alias template for an STL container that uses a certain RawAllocator.
Definition container.hpp:134
Same as above but uses std::scoped_allocator_adaptor so the allocator is inherited by all nested cont...
Definition container.hpp:53
Alias template for an STL container that uses a certain RawAllocator.
Definition container.hpp:46
#define WPI_ALIAS_TEMPLATE(Name,...)
Definition config.hpp:73
std::stack< T, Container > make_stack(RawAllocator &allocator)
Definition container.hpp:218
std::priority_queue< T, Container, Compare > make_priority_queue(RawAllocator &allocator, Compare comp={})
Definition container.hpp:233
std::queue< T, Container > make_queue(RawAllocator &allocator)
Definition container.hpp:225
detail namespace with internal helper functions
Definition input_adapters.h:32
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
Class wpi::memory::std_allocator and related classes and functions.
The node size required by allocate_shared.
Definition container.hpp:361
Contains the node size of a node based STL container with a specific type.
Definition container.hpp:283
Contains the node size of a node based STL container with a specific type.
Definition container.hpp:289
Contains the node size of a node based STL container with a specific type.
Definition container.hpp:325
Contains the node size of a node based STL container with a specific type.
Definition container.hpp:331
Contains the node size of a node based STL container with a specific type.
Definition container.hpp:301
Contains the node size of a node based STL container with a specific type.
Definition container.hpp:295
Contains the node size of a node based STL container with a specific type.
Definition container.hpp:350
Contains the node size of a node based STL container with a specific type.
Definition container.hpp:337
Contains the node size of a node based STL container with a specific type.
Definition container.hpp:344
Contains the node size of a node based STL container with a specific type.
Definition container.hpp:314
Contains the node size of a node based STL container with a specific type.
Definition container.hpp:307