Iros
 
Loading...
Searching...
No Matches
iris::ObjectPool< T, Alloc > Class Template Reference

A fixed-capacity object pool. More...

#include <iris/core/object_pool.h>

Public Member Functions

 ObjectPool ()=default
 
 ObjectPool (ObjectPool &&other)
 
 ~ObjectPool ()
 
auto operator= (ObjectPool &&other) -> ObjectPool &
 
void clear ()
 
auto allocate () -> Expected< T & >
 
void deallocate (T &object)
 

Static Public Member Functions

static auto create (usize requested_capacity) -> Expected< ObjectPool >
 

Detailed Description

template<typename T, di::concepts::FallibleAllocator Alloc = di::DefaultAllocator>
class iris::ObjectPool< T, Alloc >

A fixed-capacity object pool.

Template Parameters
TThe type of the objects to be stored in the pool. T must be derived from di::IntrusiveListNode<> and be default constructible.
AllocThe allocator to be used to allocate the pool's storage.
Warning
This class is not thread-safe. Use di::Synchronized<> to make it thread-safe.

Constructor & Destructor Documentation

◆ ObjectPool() [1/2]

template<typename T, di::concepts::FallibleAllocator Alloc = di::DefaultAllocator>
iris::ObjectPool< T, Alloc >::ObjectPool ( )
default

◆ ObjectPool() [2/2]

template<typename T, di::concepts::FallibleAllocator Alloc = di::DefaultAllocator>
iris::ObjectPool< T, Alloc >::ObjectPool ( ObjectPool< T, Alloc > && other)
inline

◆ ~ObjectPool()

template<typename T, di::concepts::FallibleAllocator Alloc = di::DefaultAllocator>
iris::ObjectPool< T, Alloc >::~ObjectPool ( )
inline

Member Function Documentation

◆ allocate()

template<typename T, di::concepts::FallibleAllocator Alloc = di::DefaultAllocator>
auto iris::ObjectPool< T, Alloc >::allocate ( ) -> Expected<T&>
inline

◆ clear()

template<typename T, di::concepts::FallibleAllocator Alloc = di::DefaultAllocator>
void iris::ObjectPool< T, Alloc >::clear ( )
inline

◆ create()

template<typename T, di::concepts::FallibleAllocator Alloc = di::DefaultAllocator>
static auto iris::ObjectPool< T, Alloc >::create ( usize requested_capacity) -> Expected<ObjectPool>
inlinestatic

◆ deallocate()

template<typename T, di::concepts::FallibleAllocator Alloc = di::DefaultAllocator>
void iris::ObjectPool< T, Alloc >::deallocate ( T & object)
inline

◆ operator=()

template<typename T, di::concepts::FallibleAllocator Alloc = di::DefaultAllocator>
auto iris::ObjectPool< T, Alloc >::operator= ( ObjectPool< T, Alloc > && other) -> ObjectPool&
inline

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