memory
allocator_deleter< Type[], RawAllocator > Class Template Reference

Detailed Description

template<typename Type, class RawAllocator>
class foonathan::memory::allocator_deleter< Type[], RawAllocator >

Specialization of allocator_deleter for array types.

Otherwise the same behavior.

Typedefs

using allocator_type
 
using value_type
 
using allocator_type
 
using value_type
 

Member Functions

 allocator_deleter () noexcept
 
 allocator_deleter (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
 
 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())
 

Constructors

◆ allocator_deleter() [1/4]

template<typename Type, class RawAllocator>
allocator_deleter ( )
noexcept
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/4]

template<typename Type, class RawAllocator>
allocator_deleter ( allocator_reference< RawAllocator > alloc,
std::size_t size )
noexcept
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.

◆ allocator_deleter() [3/4]

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() [4/4]

allocator_deleter ( allocator_reference< RawAllocator > alloc)
noexcept
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 Functions

◆ operator()() [1/2]

template<typename Type, class RawAllocator>
void operator() ( value_type * pointer)
noexcept
Effects:
Calls the destructors and 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 for the deallocation.
Requires:
The deleter must not have been created by the default constructor.

◆ get_allocator() [1/2]

template<typename Type, class RawAllocator>
auto get_allocator ( ) const -> decltype(std::declval<allocator_reference<allocator_type>>().get_allocator())
noexcept
Returns:
The reference to the allocator. It has the same type as the call to get_allocator().
Requires:
The deleter must not be created by the default constructor.

◆ array_size()

template<typename Type, class RawAllocator>
std::size_t array_size ( ) const
noexcept
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.

◆ operator()() [2/2]

void operator() ( value_type * pointer)
noexcept
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.

◆ get_allocator() [2/2]

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