WPILibC++ 2025.1.1
Loading...
Searching...
No Matches
sleipnir::PoolAllocator< T > Class Template Reference

This class is an allocator for the pool resource. More...

#include </home/runner/work/allwpilib/allwpilib/wpimath/src/main/native/thirdparty/sleipnir/include/sleipnir/util/Pool.hpp>

Public Types

using value_type = T
 The type of object in the pool.
 

Public Member Functions

constexpr PoolAllocator (PoolResource *r)
 Constructs a pool allocator with the given pool memory resource.
 
constexpr PoolAllocator (const PoolAllocator< T > &other)=default
 
constexpr PoolAllocator< T > & operator= (const PoolAllocator< T > &)=default
 
constexpr T * allocate (size_t n)
 Returns a block of memory from the pool.
 
constexpr void deallocate (T *p, size_t n)
 Gives a block of memory back to the pool.
 

Detailed Description

template<typename T>
class sleipnir::PoolAllocator< T >

This class is an allocator for the pool resource.

Template Parameters
TThe type of object in the pool.

Member Typedef Documentation

◆ value_type

template<typename T >
using sleipnir::PoolAllocator< T >::value_type = T

The type of object in the pool.

Constructor & Destructor Documentation

◆ PoolAllocator() [1/2]

template<typename T >
sleipnir::PoolAllocator< T >::PoolAllocator ( PoolResource * r)
inlineexplicitconstexpr

Constructs a pool allocator with the given pool memory resource.

Parameters
rThe pool resource.

◆ PoolAllocator() [2/2]

template<typename T >
sleipnir::PoolAllocator< T >::PoolAllocator ( const PoolAllocator< T > & other)
constexprdefault

Member Function Documentation

◆ allocate()

template<typename T >
T * sleipnir::PoolAllocator< T >::allocate ( size_t n)
inlinenodiscardconstexpr

Returns a block of memory from the pool.

Parameters
nNumber of bytes in the block.

◆ deallocate()

template<typename T >
void sleipnir::PoolAllocator< T >::deallocate ( T * p,
size_t n )
inlineconstexpr

Gives a block of memory back to the pool.

Parameters
pA pointer to the block of memory.
nNumber of bytes in the block.

◆ operator=()

template<typename T >
PoolAllocator< T > & sleipnir::PoolAllocator< T >::operator= ( const PoolAllocator< T > & )
constexprdefault

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