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

Similar to allocator_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 = Type
 

Public Member Functions

 allocator_deleter () noexcept=default
 
 allocator_deleter (allocator_reference< RawAllocator > alloc) noexcept
 
void operator() (value_type *pointer) noexcept
 
auto get_allocator () const noexcept -> decltype(std::declval< allocator_reference< allocator_type > >().get_allocator())
 

Detailed Description

template<typename Type, class RawAllocator>
class wpi::memory::allocator_deleter< Type, RawAllocator >

Similar to allocator_deallocator but calls the destructors of the object.

Otherwise behaves the same.

Member Typedef Documentation

◆ allocator_type

template<typename Type , class RawAllocator >
using wpi::memory::allocator_deleter< Type, RawAllocator >::allocator_type = typename allocator_reference<RawAllocator>::allocator_type

◆ value_type

template<typename Type , class RawAllocator >
using wpi::memory::allocator_deleter< Type, RawAllocator >::value_type = Type

Constructor & Destructor Documentation

◆ allocator_deleter() [1/2]

template<typename Type , class RawAllocator >
wpi::memory::allocator_deleter< Type, RawAllocator >::allocator_deleter ( )
defaultnoexcept
Effects:
Creates it without any associated allocator. The deleter must not be used if that is the case.
Notes:
This functions is useful if you have want to create an empty smart pointer without giving it an allocator.

◆ allocator_deleter() [2/2]

template<typename Type , class RawAllocator >
wpi::memory::allocator_deleter< Type, RawAllocator >::allocator_deleter ( allocator_reference< RawAllocator > alloc)
inlinenoexcept
Effects:
Creates it by passing it an allocator_reference. It will store the reference to it and uses the referenced allocator object for the deallocation.

Member Function Documentation

◆ get_allocator()

template<typename Type , class RawAllocator >
auto wpi::memory::allocator_deleter< Type, 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 Type , class RawAllocator >
void wpi::memory::allocator_deleter< Type, RawAllocator >::operator() ( value_type * pointer)
inlinenoexcept
Effects:
Calls the destructor and deallocates the memory given to it. Calls deallocate_node(pointer, sizeof(value_type), alignof(value_type)) on the referenced allocator object for the deallocation.
Requires:
The deleter must not have been created by the default constructor.

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