WPILibC++ 2025.3.2
Loading...
Searching...
No Matches
wpi::memory::allocator_deallocator< Type[], RawAllocator > Class Template Reference

Specialization of allocator_deallocator for array types. 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_deallocator () noexcept
 
 allocator_deallocator (allocator_reference< RawAllocator > alloc, std::size_t size) noexcept
 
void operator() (value_type *pointer) noexcept
 
auto get_allocator () const noexcept -> decltype(std::declval< allocator_reference< allocator_type > >().get_allocator())
 
std::size_t array_size () const noexcept
 

Detailed Description

template<typename Type, class RawAllocator>
class wpi::memory::allocator_deallocator< Type[], RawAllocator >

Specialization of allocator_deallocator for array types.

Otherwise the same behavior.

Member Typedef Documentation

◆ allocator_type

template<typename Type , class RawAllocator >
using wpi::memory::allocator_deallocator< Type[], RawAllocator >::allocator_type = typename allocator_reference<RawAllocator>::allocator_type

◆ value_type

template<typename Type , class RawAllocator >
using wpi::memory::allocator_deallocator< Type[], RawAllocator >::value_type = Type

Constructor & Destructor Documentation

◆ allocator_deallocator() [1/2]

template<typename Type , class RawAllocator >
wpi::memory::allocator_deallocator< Type[], RawAllocator >::allocator_deallocator ( )
inlinenoexcept
Effects:
Creates it without any associated allocator. The deallocator 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_deallocator() [2/2]

template<typename Type , class RawAllocator >
wpi::memory::allocator_deallocator< Type[], RawAllocator >::allocator_deallocator ( allocator_reference< RawAllocator > alloc,
std::size_t size )
inlinenoexcept
Effects:
Creates it by passing it an allocator_reference and the size of the array that will be deallocated. It will store the reference to the allocator and uses the referenced allocator object for the deallocation.

Member Function Documentation

◆ array_size()

template<typename Type , class RawAllocator >
std::size_t wpi::memory::allocator_deallocator< Type[], RawAllocator >::array_size ( ) const
inlinenoexcept
Returns:
The size of the array that will be deallocated. This is the same value as passed in the constructor, or 0 if it was created by the default constructor.

◆ get_allocator()

template<typename Type , class RawAllocator >
auto wpi::memory::allocator_deallocator< 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().
Requires:
The deallocator must not have been created by the default constructor.

◆ operator()()

template<typename Type , class RawAllocator >
void wpi::memory::allocator_deallocator< Type[], RawAllocator >::operator() ( value_type * pointer)
inlinenoexcept
Effects:
Deallocates the memory given to it. Calls deallocate_array(pointer, size, sizeof(value_type), alignof(value_type)) on the referenced allocator object with the size given in the constructor.
Requires:
The deallocator must not have been created by the default constructor.

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