ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
ADS::PoolAllocator< T, R > Class Template Reference

the standard allocator of objects of type T over the resource R More...

#include <ADS/memory/PoolAllocator.h>

Classes

struct  rebind
 the allocator of the objects of type U over the same resource More...

Public types

using value_type = T
 the objects
using size_type = std::size_t
 a number of objects
using difference_type = std::ptrdiff_t
 a distance in objects
using propagate_on_container_copy_assignment = std::true_type
 the allocator copied with the container
using propagate_on_container_move_assignment = std::true_type
 the allocator moved with the container
using propagate_on_container_swap = std::true_type
 the allocator swapped with the container
using is_always_equal = std::false_type
 two allocators are equal only if they share their resource

Public member functions

 PoolAllocator (R &r) noexcept
 the allocator of the resource r
 PoolAllocator (void) noexcept
 the allocator of the default resource of R, if it has one
template<class U>
 PoolAllocator (const PoolAllocator< U, R > &o) noexcept
 the allocator of the resource of \( o \), for objects of type T
T * allocate (std::size_t n)
 room for \( n \) objects, the class found at compile time when \( n = 1 \)
void deallocate (T *p, std::size_t n)
 the room \( p \) of \( n \) objects given back
R * resource (void) const noexcept
 the resource
template<class U>
bool operator== (const PoolAllocator< U, R > &o) const noexcept
 whether the two share their resource

Detailed description

template<class T, class R = PoolResource<>>
class ADS::PoolAllocator< T, R >

the standard allocator of objects of type T over the resource R

Member typedef documentation

◆ difference_type

template<class T, class R = PoolResource<>>
using ADS::PoolAllocator< T, R >::difference_type = std::ptrdiff_t

a distance in objects

◆ is_always_equal

template<class T, class R = PoolResource<>>
using ADS::PoolAllocator< T, R >::is_always_equal = std::false_type

two allocators are equal only if they share their resource

◆ propagate_on_container_copy_assignment

template<class T, class R = PoolResource<>>
using ADS::PoolAllocator< T, R >::propagate_on_container_copy_assignment = std::true_type

the allocator copied with the container

◆ propagate_on_container_move_assignment

template<class T, class R = PoolResource<>>
using ADS::PoolAllocator< T, R >::propagate_on_container_move_assignment = std::true_type

the allocator moved with the container

◆ propagate_on_container_swap

template<class T, class R = PoolResource<>>
using ADS::PoolAllocator< T, R >::propagate_on_container_swap = std::true_type

the allocator swapped with the container

◆ size_type

template<class T, class R = PoolResource<>>
using ADS::PoolAllocator< T, R >::size_type = std::size_t

a number of objects

◆ value_type

template<class T, class R = PoolResource<>>
using ADS::PoolAllocator< T, R >::value_type = T

the objects

Constructor and destructor documentation

◆ PoolAllocator() [1/3]

template<class T, class R = PoolResource<>>
ADS::PoolAllocator< T, R >::PoolAllocator ( R & r)
inlinenoexcept

the allocator of the resource r

◆ PoolAllocator() [2/3]

template<class T, class R = PoolResource<>>
ADS::PoolAllocator< T, R >::PoolAllocator ( void )
inlinenoexcept

the allocator of the default resource of R, if it has one

◆ PoolAllocator() [3/3]

template<class T, class R = PoolResource<>>
template<class U>
ADS::PoolAllocator< T, R >::PoolAllocator ( const PoolAllocator< U, R > & o)
inlinenoexcept

the allocator of the resource of \( o \), for objects of type T

Member function documentation

◆ allocate()

template<class T, class R = PoolResource<>>
T * ADS::PoolAllocator< T, R >::allocate ( std::size_t n)
nodiscard

room for \( n \) objects, the class found at compile time when \( n = 1 \)

◆ deallocate()

template<class T, class R = PoolResource<>>
void ADS::PoolAllocator< T, R >::deallocate ( T * p,
std::size_t n )

the room \( p \) of \( n \) objects given back

Precondition
\( p \) was given by allocate( n ) of an allocator equal to this one

◆ operator==()

template<class T, class R = PoolResource<>>
template<class U>
bool ADS::PoolAllocator< T, R >::operator== ( const PoolAllocator< U, R > & o) const
inlinenoexcept

whether the two share their resource

◆ resource()

template<class T, class R = PoolResource<>>
R * ADS::PoolAllocator< T, R >::resource ( void ) const
inlinenodiscardnoexcept

the resource


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