Documentation of memory

( foonathan/memory)

memory_resource_allocator Class Reference

Detailed Description

Wraps a memory_resource and makes it a RawAllocator.

Member Functions

 memory_resource_allocator (memory_resource *ptr) noexcept
 
void * allocate_node (std::size_t size, std::size_t alignment)
 
void deallocate_node (void *ptr, std::size_t size, std::size_t alignment) noexcept
 
std::size_t max_alignment () const noexcept
 
memory_resourceresource () const noexcept
 

Constructors

§ memory_resource_allocator()

Effects:
Creates it by giving it a pointer to the memory_resource.
Requires:
ptr must not be nullptr.

Member Functions

§ allocate_node()

void* allocate_node ( std::size_t  size,
std::size_t  alignment 
)
Effects:
Allocates a node by forwarding to the allocate() function.
Returns:
The node as returned by the memory_resource.
Throws:
Anything thrown by the allocate() function.

§ deallocate_node()

void deallocate_node ( void *  ptr,
std::size_t  size,
std::size_t  alignment 
)
noexcept
Effects:
Deallocates a node by forwarding to the deallocate() function.

§ max_alignment()

std::size_t max_alignment ( ) const
noexcept
Returns:
The maximum alignment which is the maximum value of type std::size_t.

§ resource()

memory_resource* resource ( ) const
noexcept
Returns:
A pointer to the used memory_resource, this is never nullptr.