Typedefs | Member Functions
allocator_polymorphic_deallocator< BaseType, RawAllocator > Class Template Reference

Detailed Description

template<typename BaseType, class RawAllocator>
class foonathan::memory::allocator_polymorphic_deallocator< BaseType, RawAllocator >

A deleter class that deallocates the memory of a derived type through a specified RawAllocator.

It can only be created from a allocator_deallocator and thus must only be used for smart pointers initialized by derived-to-base conversion of the pointer.


using allocator_type = typename allocator_reference< RawAllocator >::allocator_type
using value_type = BaseType

Member Functions

template<typename T , FOONATHAN_REQUIRES((std::is_base_of< BaseType, T >::value)) >
 allocator_polymorphic_deallocator (allocator_deallocator< T, RawAllocator > dealloc)
void operator() (value_type *pointer) noexcept
auto get_allocator () const noexcept -> decltype(std::declval< allocator_reference< allocator_type >>().get_allocator())


◆ allocator_polymorphic_deallocator()

Creates it from a deallocator for a derived type. It will deallocate the memory as if done by the derived type.

Member Functions

◆ operator()()

void operator() ( value_type *  pointer)
Deallocates the memory given to it. Calls deallocate_node(pointer, size, alignment) on the referenced allocator object, where size and alignment are the values of the type it was created with.

◆ get_allocator()

auto get_allocator ( ) const -> decltype(std::declval<allocator_reference<allocator_type>>().get_allocator())
The reference to the allocator. It has the same type as the call to allocator_reference::get_allocator().