WPILibC++ 2025.1.1
Loading...
Searching...
No Matches
wpi::memory::allocator_polymorphic_deleter< BaseType, RawAllocator > Class Template Reference

Similar to allocator_polymorphic_deallocator but calls the destructors of the object. More...

#include <wpi/memory/deleter.hpp>

Public Types

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

Public Member Functions

template<typename T >
 allocator_polymorphic_deleter (allocator_deleter< T, RawAllocator > deleter)
 
void operator() (value_type *pointer) noexcept
 
auto get_allocator () const noexcept -> decltype(std::declval< allocator_reference< allocator_type > >().get_allocator())
 

Detailed Description

template<typename BaseType, class RawAllocator>
class wpi::memory::allocator_polymorphic_deleter< BaseType, RawAllocator >

Similar to allocator_polymorphic_deallocator but calls the destructors of the object.

Otherwise behaves the same.

Note
It has a relatively high space overhead, so only use it if you have to.

Member Typedef Documentation

◆ allocator_type

template<typename BaseType , class RawAllocator >
using wpi::memory::allocator_polymorphic_deleter< BaseType, RawAllocator >::allocator_type = typename allocator_reference<RawAllocator>::allocator_type

◆ value_type

template<typename BaseType , class RawAllocator >
using wpi::memory::allocator_polymorphic_deleter< BaseType, RawAllocator >::value_type = BaseType

Constructor & Destructor Documentation

◆ allocator_polymorphic_deleter()

template<typename BaseType , class RawAllocator >
template<typename T >
wpi::memory::allocator_polymorphic_deleter< BaseType, RawAllocator >::allocator_polymorphic_deleter ( allocator_deleter< T, RawAllocator > deleter)
inline
Effects:
Creates it from a deleter for a derived type. It will deallocate the memory as if done by the derived type.

Member Function Documentation

◆ get_allocator()

template<typename BaseType , class RawAllocator >
auto wpi::memory::allocator_polymorphic_deleter< BaseType, RawAllocator >::get_allocator ( ) const -> decltype(std::declval<allocator_reference<allocator_type>>().get_allocator())
inlinenoexcept
Returns:
The reference to the allocator. It has the same type as the call to allocator_reference::get_allocator().

◆ operator()()

template<typename BaseType , class RawAllocator >
void wpi::memory::allocator_polymorphic_deleter< BaseType, RawAllocator >::operator() ( value_type * pointer)
inlinenoexcept
Effects:
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.

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