4#ifndef WPI_MEMORY_DELETER_HPP_INCLUDED
5#define WPI_MEMORY_DELETER_HPP_INCLUDED
24 template <
typename Type,
class RawAllocator>
27 static_assert(!std::is_abstract<Type>::value,
28 "use allocator_polymorphic_deallocator for storing base classes");
67 template <
typename Type,
class RawAllocator>
69 : WPI_EBO(allocator_reference<RawAllocator>)
71 static_assert(!std::is_abstract<Type>::value,
"must not create polymorphic arrays");
85 std::size_t size) noexcept
123 template <
typename BaseType,
class RawAllocator>
132 template <
typename T, WPI_REQUIRES((std::is_base_of<BaseType, T>::value))>
135 derived_size_(sizeof(T)),
136 derived_alignment_(alignof(T))
145 this->deallocate_node(
pointer, derived_size_, derived_alignment_);
157 std::size_t derived_size_, derived_alignment_;
163 template <
typename Type,
class RawAllocator>
166 static_assert(!std::is_abstract<Type>::value,
167 "use allocator_polymorphic_deleter for storing base classes");
207 template <
typename Type,
class RawAllocator>
209 : WPI_EBO(allocator_reference<RawAllocator>)
211 static_assert(!std::is_abstract<Type>::value,
"must not create polymorphic arrays");
264 template <
typename BaseType,
class RawAllocator>
273 template <
typename T, WPI_REQUIRES((std::is_base_of<BaseType, T>::value))>
276 derived_size_(sizeof(T)),
277 derived_alignment_(alignof(T))
280 && std::size_t(derived_alignment_) ==
alignof(T));
289 this->deallocate_node(
pointer, derived_size_, derived_alignment_);
301 unsigned short derived_size_,
Class template wpi::memory::allocator_storage, some policies and resulting typedefs.
void operator()(value_type *pointer) noexcept
Definition deleter.hpp:94
Type value_type
Definition deleter.hpp:75
std::size_t array_size() const noexcept
Definition deleter.hpp:110
allocator_deallocator() noexcept
Definition deleter.hpp:80
allocator_deallocator(allocator_reference< RawAllocator > alloc, std::size_t size) noexcept
Definition deleter.hpp:84
typename allocator_reference< RawAllocator >::allocator_type allocator_type
Definition deleter.hpp:74
auto get_allocator() const noexcept -> decltype(std::declval< allocator_reference< allocator_type > >().get_allocator())
Definition deleter.hpp:102
A deleter class that deallocates the memory through a specified RawAllocator.
Definition deleter.hpp:26
allocator_deallocator() noexcept=default
void operator()(value_type *pointer) noexcept
Definition deleter.hpp:49
Type value_type
Definition deleter.hpp:32
typename allocator_reference< RawAllocator >::allocator_type allocator_type
Definition deleter.hpp:31
auto get_allocator() const noexcept -> decltype(std::declval< allocator_reference< allocator_type > >().get_allocator())
Definition deleter.hpp:57
std::size_t array_size() const noexcept
Definition deleter.hpp:251
Type value_type
Definition deleter.hpp:215
typename allocator_reference< RawAllocator >::allocator_type allocator_type
Definition deleter.hpp:214
void operator()(value_type *pointer) noexcept
Definition deleter.hpp:233
allocator_deleter(allocator_reference< RawAllocator > alloc, std::size_t size) noexcept
Definition deleter.hpp:224
allocator_deleter() noexcept
Definition deleter.hpp:220
auto get_allocator() const noexcept -> decltype(std::declval< allocator_reference< allocator_type > >().get_allocator())
Definition deleter.hpp:243
Similar to allocator_deallocator but calls the destructors of the object.
Definition deleter.hpp:165
Type value_type
Definition deleter.hpp:171
allocator_deleter() noexcept=default
void operator()(value_type *pointer) noexcept
Definition deleter.hpp:189
typename allocator_reference< RawAllocator >::allocator_type allocator_type
Definition deleter.hpp:170
auto get_allocator() const noexcept -> decltype(std::declval< allocator_reference< allocator_type > >().get_allocator())
Definition deleter.hpp:197
A deleter class that deallocates the memory of a derived type through a specified RawAllocator.
Definition deleter.hpp:125
BaseType value_type
Definition deleter.hpp:128
auto get_allocator() const noexcept -> decltype(std::declval< allocator_reference< allocator_type > >().get_allocator())
Definition deleter.hpp:150
typename allocator_reference< RawAllocator >::allocator_type allocator_type
Definition deleter.hpp:127
allocator_polymorphic_deallocator(allocator_deallocator< T, RawAllocator > dealloc)
Definition deleter.hpp:133
void operator()(value_type *pointer) noexcept
Definition deleter.hpp:143
Similar to allocator_polymorphic_deallocator but calls the destructors of the object.
Definition deleter.hpp:266
BaseType value_type
Definition deleter.hpp:269
void operator()(value_type *pointer) noexcept
Definition deleter.hpp:286
auto get_allocator() const noexcept -> decltype(std::declval< allocator_reference< allocator_type > >().get_allocator())
Definition deleter.hpp:294
allocator_polymorphic_deleter(allocator_deleter< T, RawAllocator > deleter)
Definition deleter.hpp:274
typename allocator_reference< RawAllocator >::allocator_type allocator_type
Definition deleter.hpp:268
An alias template for allocator_storage using the reference_storage policy.
Definition allocator_storage.hpp:900
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
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
#define WPI_MEMORY_ASSERT(Expr)
Definition assert.hpp:46