bit::memory
Public Types | Public Member Functions | Friends | List of all members
bit::memory::polymorphic_allocator_deleter< T, AllocatorStorage > Class Template Reference

A deleter for bit::memory allocators that allows for polymorphic conversions, at the cost of storing the size of the allocation in the deleter. More...

#include <polymorphic_allocator_deleter.hpp>

Inheritance diagram for bit::memory::polymorphic_allocator_deleter< T, AllocatorStorage >:
bit::memory::ebo_storage< AllocatorStorage >

Public Types

using void_pointer = typename alloc_traits::pointer
 
using pointer = typename pointer_traits::template rebind< T >
 
using size_type = typename alloc_traits::size_type
 
using difference_type = typename alloc_traits::difference_type
 

Public Member Functions

 polymorphic_allocator_deleter (AllocatorStorage storage) noexcept
 Constructs an polymorphic_allocator_deleter that uses the referenced allocator for deletion. More...
 
 polymorphic_allocator_deleter (polymorphic_allocator_deleter &&other) noexcept=default
 Move-constructs an polymorphic_allocator_deleter from an existing one. More...
 
 polymorphic_allocator_deleter (const polymorphic_allocator_deleter &other) noexcept=default
 Copy-constructs the polymorphic_allocator_deleter from an existing one. More...
 
template<typename U , typename = std::enable_if_t<std::is_convertible<U,T>::value>>
 polymorphic_allocator_deleter (polymorphic_allocator_deleter< U, AllocatorStorage > &&other) noexcept
 
template<typename U , typename = std::enable_if_t<std::is_convertible<U,T>::value>>
 polymorphic_allocator_deleter (const polymorphic_allocator_deleter< U, AllocatorStorage > &other) noexcept
 
polymorphic_allocator_deleteroperator= (polymorphic_allocator_deleter &&other) noexcept=default
 Move-assigns an polymorphic_allocator_deleter from an existing one. More...
 
polymorphic_allocator_deleteroperator= (const polymorphic_allocator_deleter &other) noexcept=default
 Copy-assigns an polymorphic_allocator_deleter from an existing one. More...
 
template<typename U , typename = std::enable_if_t<std::is_convertible<U,T>::value>>
polymorphic_allocator_deleteroperator= (polymorphic_allocator_deleter< U, AllocatorStorage > &&other) noexcept
 
template<typename U , typename = std::enable_if_t<std::is_convertible<U,T>::value>>
polymorphic_allocator_deleteroperator= (const polymorphic_allocator_deleter< U, AllocatorStorage > &other) noexcept
 
void operator() (pointer p)
 Deletes the underlying pointer p. More...
 

Friends

template<typename , typename >
class polymorphic_allocator_deleter
 

Detailed Description

template<typename T, typename AllocatorStorage>
class bit::memory::polymorphic_allocator_deleter< T, AllocatorStorage >

A deleter for bit::memory allocators that allows for polymorphic conversions, at the cost of storing the size of the allocation in the deleter.

Template Parameters
Tthe underlying type
AllocatorStoragethe storage for the allocator

Definition at line 63 of file polymorphic_allocator_deleter.hpp.

Constructor & Destructor Documentation

◆ polymorphic_allocator_deleter() [1/3]

template<typename T, typename AllocatorStorage>
bit::memory::polymorphic_allocator_deleter< T, AllocatorStorage >::polymorphic_allocator_deleter ( AllocatorStorage  storage)
explicitnoexcept

Constructs an polymorphic_allocator_deleter that uses the referenced allocator for deletion.

Parameters
storagethe allocator storage

◆ polymorphic_allocator_deleter() [2/3]

template<typename T, typename AllocatorStorage>
bit::memory::polymorphic_allocator_deleter< T, AllocatorStorage >::polymorphic_allocator_deleter ( polymorphic_allocator_deleter< T, AllocatorStorage > &&  other)
defaultnoexcept

Move-constructs an polymorphic_allocator_deleter from an existing one.

Parameters
otherthe other polymorphic_allocator_deleter to move

◆ polymorphic_allocator_deleter() [3/3]

template<typename T, typename AllocatorStorage>
bit::memory::polymorphic_allocator_deleter< T, AllocatorStorage >::polymorphic_allocator_deleter ( const polymorphic_allocator_deleter< T, AllocatorStorage > &  other)
defaultnoexcept

Copy-constructs the polymorphic_allocator_deleter from an existing one.

Parameters
otherthe other polymorphic_allocator_deleter to copy

Member Function Documentation

◆ operator()()

template<typename T, typename AllocatorStorage>
void bit::memory::polymorphic_allocator_deleter< T, AllocatorStorage >::operator() ( pointer  p)

Deletes the underlying pointer p.

Parameters
pthe pointer to delete

◆ operator=() [1/2]

template<typename T, typename AllocatorStorage>
polymorphic_allocator_deleter& bit::memory::polymorphic_allocator_deleter< T, AllocatorStorage >::operator= ( polymorphic_allocator_deleter< T, AllocatorStorage > &&  other)
defaultnoexcept

Move-assigns an polymorphic_allocator_deleter from an existing one.

Parameters
otherthe other polymorphic_allocator_deleter to move
Returns
reference to (*this)

◆ operator=() [2/2]

template<typename T, typename AllocatorStorage>
polymorphic_allocator_deleter& bit::memory::polymorphic_allocator_deleter< T, AllocatorStorage >::operator= ( const polymorphic_allocator_deleter< T, AllocatorStorage > &  other)
defaultnoexcept

Copy-assigns an polymorphic_allocator_deleter from an existing one.

Parameters
otherthe other polymorphic_allocator_deleter to copy
Returns
reference to (*this)

The documentation for this class was generated from the following file: