WPILibC++ 2025.3.2
Loading...
Searching...
No Matches
wpi::memory::allocator_traits< memory_pool< PoolType, ImplRawAllocator > > Class Template Reference

Specialization of the allocator_traits for memory_pool classes. More...

#include <wpi/memory/memory_pool.hpp>

Public Types

using allocator_type = memory_pool<PoolType, ImplRawAllocator>
 
using is_stateful = std::true_type
 

Static Public Member Functions

static void * allocate_node (allocator_type &state, std::size_t size, std::size_t alignment)
 
static void * allocate_array (allocator_type &state, std::size_t count, std::size_t size, std::size_t alignment)
 
static void deallocate_node (allocator_type &state, void *node, std::size_t size, std::size_t) noexcept
 
static void deallocate_array (allocator_type &state, void *array, std::size_t count, std::size_t size, std::size_t) noexcept
 
static std::size_t max_node_size (const allocator_type &state) noexcept
 
static std::size_t max_array_size (const allocator_type &state) noexcept
 
static std::size_t max_alignment (const allocator_type &state) noexcept
 

Detailed Description

template<typename PoolType, class ImplRawAllocator>
class wpi::memory::allocator_traits< memory_pool< PoolType, ImplRawAllocator > >

Specialization of the allocator_traits for memory_pool classes.

Note
It is not allowed to mix calls through the specialization and through the member functions, i.e. memory_pool::allocate_node() and this allocate_node().

Member Typedef Documentation

◆ allocator_type

template<typename PoolType , class ImplRawAllocator >
using wpi::memory::allocator_traits< memory_pool< PoolType, ImplRawAllocator > >::allocator_type = memory_pool<PoolType, ImplRawAllocator>

◆ is_stateful

template<typename PoolType , class ImplRawAllocator >
using wpi::memory::allocator_traits< memory_pool< PoolType, ImplRawAllocator > >::is_stateful = std::true_type

Member Function Documentation

◆ allocate_array()

template<typename PoolType , class ImplRawAllocator >
static void * wpi::memory::allocator_traits< memory_pool< PoolType, ImplRawAllocator > >::allocate_array ( allocator_type & state,
std::size_t count,
std::size_t size,
std::size_t alignment )
inlinestatic
Effects:
Forwards to memory_pool::allocate_array() with the number of nodes adjusted to be the minimum, i.e. when the size is less than the memory_pool::node_size().
Returns:
A array with specified properties.
Requires:
The memory_pool has to support array allocations.
Throws:
Anything thrown by the pool allocation function.

◆ allocate_node()

template<typename PoolType , class ImplRawAllocator >
static void * wpi::memory::allocator_traits< memory_pool< PoolType, ImplRawAllocator > >::allocate_node ( allocator_type & state,
std::size_t size,
std::size_t alignment )
inlinestatic
Returns:
The result of memory_pool::allocate_node().
Throws:
Anything thrown by the pool allocation function or a bad_allocation_size exception.

◆ deallocate_array()

template<typename PoolType , class ImplRawAllocator >
static void wpi::memory::allocator_traits< memory_pool< PoolType, ImplRawAllocator > >::deallocate_array ( allocator_type & state,
void * array,
std::size_t count,
std::size_t size,
std::size_t  )
inlinestaticnoexcept
Effects:
Forwards to memory_pool::deallocate_array() with the same size adjustment.

◆ deallocate_node()

template<typename PoolType , class ImplRawAllocator >
static void wpi::memory::allocator_traits< memory_pool< PoolType, ImplRawAllocator > >::deallocate_node ( allocator_type & state,
void * node,
std::size_t size,
std::size_t  )
inlinestaticnoexcept
Effects:
Just forwards to memory_pool::deallocate_node().

◆ max_alignment()

template<typename PoolType , class ImplRawAllocator >
static std::size_t wpi::memory::allocator_traits< memory_pool< PoolType, ImplRawAllocator > >::max_alignment ( const allocator_type & state)
inlinestaticnoexcept
Returns:
The maximum alignment which is the next bigger power of two if less than alignof(std::max_align_t) or the maximum alignment itself otherwise.

◆ max_array_size()

template<typename PoolType , class ImplRawAllocator >
static std::size_t wpi::memory::allocator_traits< memory_pool< PoolType, ImplRawAllocator > >::max_array_size ( const allocator_type & state)
inlinestaticnoexcept
Returns:
An upper bound on the maximum array size which is memory_pool::next_capacity().

◆ max_node_size()

template<typename PoolType , class ImplRawAllocator >
static std::size_t wpi::memory::allocator_traits< memory_pool< PoolType, ImplRawAllocator > >::max_node_size ( const allocator_type & state)
inlinestaticnoexcept
Returns:
The maximum size of each node which is memory_pool::node_size().

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