FE 0.9.2
Header-only C++ frontend library
Loading...
Searching...
No Matches
fe::Arena::Allocator< T > Struct Template Reference

An allocator in order to use this Arena for containers. More...

#include <fe/arena.h>

Public Types

using value_type = T

Public Member Functions

 Allocator ()=delete
template<class U>
constexpr Allocator (const Arena::Allocator< U > &allocator) noexcept
constexpr Allocator (Arena &arena) noexcept
constexpr T * allocate (size_t num_elems)
constexpr void deallocate (T *, size_t) noexcept
template<class U>
constexpr bool operator== (const Allocator< U > &) const noexcept
 All Arena::Allocators compare equal.
template<class U>
constexpr bool operator!= (const Allocator< U > &) const noexcept

Public Attributes

Arenaarena

Detailed Description

template<class T>
struct fe::Arena::Allocator< T >

An allocator in order to use this Arena for containers.

Construct it via Arena::allocator.

Definition at line 49 of file arena.h.

Member Typedef Documentation

◆ value_type

template<class T>
using fe::Arena::Allocator< T >::value_type = T

Definition at line 50 of file arena.h.

Constructor & Destructor Documentation

◆ Allocator() [1/3]

template<class T>
fe::Arena::Allocator< T >::Allocator ( )
delete

Referenced by operator!=(), and operator==().

◆ Allocator() [2/3]

template<class T>
template<class U>
fe::Arena::Allocator< T >::Allocator ( const Arena::Allocator< U > & allocator)
inlineconstexprnoexcept

Definition at line 55 of file arena.h.

References fe::Arena::allocator().

◆ Allocator() [3/3]

template<class T>
fe::Arena::Allocator< T >::Allocator ( Arena & arena)
inlineconstexprnoexcept

Definition at line 57 of file arena.h.

References fe::Arena::Arena(), and arena.

Member Function Documentation

◆ allocate()

template<class T>
T * fe::Arena::Allocator< T >::allocate ( size_t num_elems)
inlinenodiscardconstexpr

Definition at line 60 of file arena.h.

References arena.

◆ deallocate()

template<class T>
void fe::Arena::Allocator< T >::deallocate ( T * ,
size_t  )
inlineconstexprnoexcept

Definition at line 62 of file arena.h.

◆ operator!=()

template<class T>
template<class U>
bool fe::Arena::Allocator< T >::operator!= ( const Allocator< U > & ) const
inlineconstexprnoexcept

Definition at line 70 of file arena.h.

References Allocator().

◆ operator==()

template<class T>
template<class U>
bool fe::Arena::Allocator< T >::operator== ( const Allocator< U > & ) const
inlineconstexprnoexcept

All Arena::Allocators compare equal.

Allocator equality denotes deallocation-compatibility, and Arena::Allocator::deallocate is a no-op, so storage from any instance can be "freed" through any other. This also keeps allocator-aware container swap (e.g. in SymPool::swap) well-defined without requiring propagate_on_container_swap, which we cannot enable here because arena is a non-rebindable reference.

Definition at line 69 of file arena.h.

References Allocator().

Member Data Documentation

◆ arena

template<class T>
Arena& fe::Arena::Allocator< T >::arena

Definition at line 72 of file arena.h.

Referenced by allocate(), and Allocator().


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