WPILibC++ 2025.3.2
Loading...
Searching...
No Matches
wpi::memory::allocator_traits< memory_pool_collection< Pool, BucketDist, RawAllocator > > Class Template Reference

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

#include <wpi/memory/memory_pool_collection.hpp>

Public Types

using allocator_type = memory_pool_collection<Pool, BucketDist, RawAllocator>
 
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 &) noexcept
 

Detailed Description

template<class Pool, class BucketDist, class RawAllocator>
class wpi::memory::allocator_traits< memory_pool_collection< Pool, BucketDist, RawAllocator > >

Specialization of the allocator_traits for memory_pool_collection classes.

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

Member Typedef Documentation

◆ allocator_type

template<class Pool , class BucketDist , class RawAllocator >
using wpi::memory::allocator_traits< memory_pool_collection< Pool, BucketDist, RawAllocator > >::allocator_type = memory_pool_collection<Pool, BucketDist, RawAllocator>

◆ is_stateful

template<class Pool , class BucketDist , class RawAllocator >
using wpi::memory::allocator_traits< memory_pool_collection< Pool, BucketDist, RawAllocator > >::is_stateful = std::true_type

Member Function Documentation

◆ allocate_array()

template<class Pool , class BucketDist , class RawAllocator >
static void * wpi::memory::allocator_traits< memory_pool_collection< Pool, BucketDist, RawAllocator > >::allocate_array ( allocator_type & state,
std::size_t count,
std::size_t size,
std::size_t alignment )
inlinestatic
Returns:
The result of memory_pool_collection::allocate_array().
Throws:
Anything thrown by the pool allocation function or a bad_allocation_size exception.
Requires:
The memory_pool_collection has to support array allocations.

◆ allocate_node()

template<class Pool , class BucketDist , class RawAllocator >
static void * wpi::memory::allocator_traits< memory_pool_collection< Pool, BucketDist, RawAllocator > >::allocate_node ( allocator_type & state,
std::size_t size,
std::size_t alignment )
inlinestatic
Returns:
The result of memory_pool_collection::allocate_node().
Throws:
Anything thrown by the pool allocation function or a bad_allocation_size exception if size / alignment exceeds max_node_size() / the suitable alignment value, i.e. the node is over-aligned.

◆ deallocate_array()

template<class Pool , class BucketDist , class RawAllocator >
static void wpi::memory::allocator_traits< memory_pool_collection< Pool, BucketDist, RawAllocator > >::deallocate_array ( allocator_type & state,
void * array,
std::size_t count,
std::size_t size,
std::size_t  )
inlinestaticnoexcept
Effects:
Calls memory_pool_collection::deallocate_array().
Requires:
The memory_pool_collection has to support array allocations.

◆ deallocate_node()

template<class Pool , class BucketDist , class RawAllocator >
static void wpi::memory::allocator_traits< memory_pool_collection< Pool, BucketDist, RawAllocator > >::deallocate_node ( allocator_type & state,
void * node,
std::size_t size,
std::size_t  )
inlinestaticnoexcept

◆ max_alignment()

template<class Pool , class BucketDist , class RawAllocator >
static std::size_t wpi::memory::allocator_traits< memory_pool_collection< Pool, BucketDist, RawAllocator > >::max_alignment ( const allocator_type & )
inlinestaticnoexcept
Returns:
Just alignof(std::max_align_t) since the actual maximum alignment depends on the node size, the nodes must not be over-aligned.

◆ max_array_size()

template<class Pool , class BucketDist , class RawAllocator >
static std::size_t wpi::memory::allocator_traits< memory_pool_collection< Pool, BucketDist, RawAllocator > >::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<class Pool , class BucketDist , class RawAllocator >
static std::size_t wpi::memory::allocator_traits< memory_pool_collection< Pool, BucketDist, RawAllocator > >::max_node_size ( const allocator_type & state)
inlinestaticnoexcept
Returns:
The maximum size of each node which is memory_pool_collection::max_node_size().

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