31 #ifndef BIT_MEMORY_ADAPTERS_POLYMORPHIC_ALLOCATOR_DELETER_HPP 32 #define BIT_MEMORY_ADAPTERS_POLYMORPHIC_ALLOCATOR_DELETER_HPP 34 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 36 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 38 #include "../utilities/ebo_storage.hpp" 39 #include "../utilities/pointer_utilities.hpp" 41 #include "../concepts/AllocatorStorage.hpp" 43 #include "../traits/allocator_traits.hpp" 47 #include <type_traits> 62 template<
typename T,
typename AllocatorStorage>
67 using allocator_type =
typename AllocatorStorage::allocator_type;
70 using pointer_traits = std::pointer_traits<typename alloc_traits::pointer>;
72 static_assert( !std::is_reference<T>::value,
"Unable to delete reference type" );
73 static_assert( !std::is_const<T>::value,
"Unable to delete const type" );
74 static_assert( !std::is_void<T>::value,
"Unable to delete void type" );
76 "AllocatorStorage must satisfy AllocatorStorage requirements" );
83 using void_pointer =
typename alloc_traits::pointer;
84 using pointer =
typename pointer_traits::template rebind<T>;
85 using size_type =
typename alloc_traits::size_type;
86 using difference_type =
typename alloc_traits::difference_type;
114 typename = std::enable_if_t<std::is_convertible<U,T>::value>>
118 typename = std::enable_if_t<std::is_convertible<U,T>::value>>
139 typename = std::enable_if_t<std::is_convertible<U,T>::value>>
144 typename = std::enable_if_t<std::is_convertible<U,T>::value>>
172 AllocatorStorage storage()
const noexcept;
174 std::size_t size()
const noexcept;
178 template<
typename T,
typename AllocatorStorage>
183 using allocator_type =
typename AllocatorStorage::allocator_type;
186 using pointer_traits = std::pointer_traits<typename alloc_traits::pointer>;
188 static_assert( !std::is_reference<T>::value,
"Unable to delete reference type" );
189 static_assert( !std::is_const<T>::value,
"Unable to delete const type" );
190 static_assert( !std::is_void<T>::value,
"Unable to delete void type" );
192 "AllocatorStorage must satisfy AllocatorStorage requirements" );
199 using void_pointer =
typename alloc_traits::pointer;
200 using pointer =
typename pointer_traits::template rebind<T>;
201 using size_type =
typename alloc_traits::size_type;
202 using difference_type =
typename alloc_traits::difference_type;
214 size_type size ) noexcept;
265 #include "detail/polymorphic_allocator_deleter.inl" Type trait to determine whether T is a AllocatorStorage.
polymorphic_allocator_deleter & operator=(polymorphic_allocator_deleter &&other) noexcept=default
Move-assigns an polymorphic_allocator_deleter from an existing one.
The allocator_traits class template provides a standardized way to access allocator functionality...
void operator()(pointer p)
Deletes the underlying pointer p.
A deleter for bit::memory allocators that allows for polymorphic conversions, at the cost of storing ...
A utility class used for leveraging empty-base optimization for a generic sequence of types...