memory
Typedefs | Static Functions
composable_allocator_traits< memory_pool< PoolType, BlockOrRawAllocator > > Class Template Reference

Detailed Description

template<typename PoolType, class BlockOrRawAllocator>
class foonathan::memory::composable_allocator_traits< memory_pool< PoolType, BlockOrRawAllocator > >

Specialization of the composable_allocator_traits for memory_pool classes.

Typedefs

using allocator_type = memory_pool< PoolType, BlockOrRawAllocator >
 

Static Functions

static void * try_allocate_node (allocator_type &state, std::size_t size, std::size_t alignment) noexcept
 
static void * try_allocate_array (allocator_type &state, std::size_t count, std::size_t size, std::size_t alignment) noexcept
 
static bool try_deallocate_node (allocator_type &state, void *node, std::size_t size, std::size_t alignment) noexcept
 
static bool try_deallocate_array (allocator_type &state, void *array, std::size_t count, std::size_t size, std::size_t alignment) noexcept
 

Member Functions

◆ try_allocate_node()

static void* try_allocate_node ( allocator_type state,
std::size_t  size,
std::size_t  alignment 
)
staticnoexcept
Returns:
The result of memory_pool::try_allocate_node() or nullptr if the allocation size was too big.

◆ try_allocate_array()

static void* try_allocate_array ( allocator_type state,
std::size_t  count,
std::size_t  size,
std::size_t  alignment 
)
staticnoexcept
Effects:
Forwards to memory_pool::try_allocate_array() with the number of nodes adjusted to be the minimum, if the size is less than the memory_pool::node_size().
Returns:
A array with specified properties or nullptr if it was unable to allocate.

◆ try_deallocate_node()

static bool try_deallocate_node ( allocator_type state,
void *  node,
std::size_t  size,
std::size_t  alignment 
)
staticnoexcept
Effects:
Just forwards to memory_pool::try_deallocate_node().
Returns:
Whether the deallocation was successful.

◆ try_deallocate_array()

static bool try_deallocate_array ( allocator_type state,
void *  array,
std::size_t  count,
std::size_t  size,
std::size_t  alignment 
)
staticnoexcept
Effects:
Forwards to memory_pool::deallocate_array() with the same size adjustment.
Returns:
Whether the deallocation was successful.