Documentation of memory

( foonathan/memory)

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

Detailed Description

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

Specialization of allocator_deleter for array types.

Otherwise the same behavior.

Typedefs

using allocator_type = typename allocator_reference< RawAllocator, Mutex >::allocator_type
 
using mutex = Mutex
 
using value_type = Type
 

Member Functions

 allocator_deleter (allocator_reference< RawAllocator, mutex > alloc, std::size_t size) noexcept
 
void operator() (value_type *pointer) noexcept
 
auto get_allocator () const noexcept -> decltype(std::declval< allocator_reference< allocator_type, mutex >>().get_allocator())
 
std::size_t array_size () const noexcept
 

Constructors

§ allocator_deleter()

allocator_deleter ( allocator_reference< RawAllocator, mutex >  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.

Member Functions

§ operator()()

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.

§ get_allocator()

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

§ array_size()

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.