Thrill  0.1
StackAllocator< Type, Size > Class Template Reference

Detailed Description

template<typename Type, size_t Size>
class tlx::StackAllocator< Type, Size >

Definition at line 114 of file stack_allocator.hpp.

+ Inheritance diagram for StackAllocator< Type, Size >:
+ Collaboration diagram for StackAllocator< Type, Size >:

#include <stack_allocator.hpp>

Classes

struct  rebind
 required rebind. More...
 

Public Types

using const_pointer = const Type *
 
using const_reference = const Type &
 
using difference_type = std::ptrdiff_t
 
using is_always_equal = std::false_type
 C++11 type flag. More...
 
using pointer = Type *
 
using reference = Type &
 
using size_type = std::size_t
 
using value_type = Type
 
- Public Types inherited from AllocatorBase< Type >
using const_pointer = const Type *
 
using const_reference = const Type &
 
using difference_type = std::ptrdiff_t
 
using is_always_equal = std::true_type
 C++11 type flag. More...
 
using pointer = Type *
 
using propagate_on_container_move_assignment = std::true_type
 C++11 type flag. More...
 
using reference = Type &
 
using size_type = std::size_t
 
using value_type = Type
 

Public Member Functions

 StackAllocator () noexcept
 default constructor to invalid arena More...
 
 StackAllocator (StackArena< Size > &arena) noexcept
 constructor with explicit arena reference More...
 
template<typename Other >
 StackAllocator (const StackAllocator< Other, Size > &other) noexcept
 constructor from another allocator with same arena size More...
 
 StackAllocator (const StackAllocator &) noexcept=default
 copy-constructor: default More...
 
 StackAllocator (StackAllocator &&) noexcept=default
 move-constructor: default More...
 
pointer allocate (size_t n)
 allocate method: get memory from arena More...
 
void deallocate (pointer p, size_t n) noexcept
 deallocate method: release from arena More...
 
template<typename Other , size_t OtherSize>
bool operator!= (const StackAllocator< Other, OtherSize > &other) const noexcept
 
StackAllocatoroperator= (const StackAllocator &) noexcept=default
 copy-assignment: default More...
 
StackAllocatoroperator= (StackAllocator &&) noexcept=default
 move-assignment: default More...
 
template<typename Other , size_t OtherSize>
bool operator== (const StackAllocator< Other, OtherSize > &other) const noexcept
 
- Public Member Functions inherited from AllocatorBase< Type >
pointer address (reference x) const noexcept
 Returns the address of x. More...
 
const_pointer address (const_reference x) const noexcept
 Returns the address of x. More...
 
void construct (pointer p, const_reference value)
 Constructs an element object on the location pointed by p. More...
 
template<typename SubType , typename... Args>
void construct (SubType *p, Args &&... args)
 Constructs an element object on the location pointed by p. More...
 
void destroy (pointer p) const noexcept
 Destroys in-place the object pointed by p. More...
 
template<typename SubType >
void destroy (SubType *p) const noexcept
 Destroys in-place the object pointed by p. More...
 
size_type max_size () const noexcept
 Maximum size possible to allocate. More...
 

Private Attributes

StackArena< Size > * arena_
 

Member Typedef Documentation

◆ const_pointer

using const_pointer = const Type *

Definition at line 119 of file stack_allocator.hpp.

◆ const_reference

using const_reference = const Type&

Definition at line 121 of file stack_allocator.hpp.

◆ difference_type

using difference_type = std::ptrdiff_t

Definition at line 123 of file stack_allocator.hpp.

◆ is_always_equal

using is_always_equal = std::false_type

C++11 type flag.

Definition at line 126 of file stack_allocator.hpp.

◆ pointer

using pointer = Type *

Definition at line 118 of file stack_allocator.hpp.

◆ reference

using reference = Type&

Definition at line 120 of file stack_allocator.hpp.

◆ size_type

using size_type = std::size_t

Definition at line 122 of file stack_allocator.hpp.

◆ value_type

using value_type = Type

Definition at line 117 of file stack_allocator.hpp.

Constructor & Destructor Documentation

◆ StackAllocator() [1/5]

StackAllocator ( )
inlinenoexcept

default constructor to invalid arena

Definition at line 133 of file stack_allocator.hpp.

◆ StackAllocator() [2/5]

StackAllocator ( StackArena< Size > &  arena)
inlineexplicitnoexcept

constructor with explicit arena reference

Definition at line 136 of file stack_allocator.hpp.

◆ StackAllocator() [3/5]

StackAllocator ( const StackAllocator< Other, Size > &  other)
inlinenoexcept

constructor from another allocator with same arena size

Definition at line 141 of file stack_allocator.hpp.

References StackArena< Size >::operator=().

◆ StackAllocator() [4/5]

StackAllocator ( const StackAllocator< Type, Size > &  )
defaultnoexcept

copy-constructor: default

◆ StackAllocator() [5/5]

StackAllocator ( StackAllocator< Type, Size > &&  )
defaultnoexcept

move-constructor: default

Member Function Documentation

◆ allocate()

pointer allocate ( size_t  n)
inline

allocate method: get memory from arena

Definition at line 159 of file stack_allocator.hpp.

◆ deallocate()

void deallocate ( pointer  p,
size_t  n 
)
inlinenoexcept

deallocate method: release from arena

Definition at line 164 of file stack_allocator.hpp.

References StackAllocator< Type, Size >::deallocate(), and StackArena< Size >::AlignmentHelper::p.

Referenced by StackAllocator< Type, Size >::deallocate().

◆ operator!=()

bool operator!= ( const StackAllocator< Other, OtherSize > &  other) const
inlinenoexcept

Definition at line 175 of file stack_allocator.hpp.

References tlx::operator==().

◆ operator=() [1/2]

StackAllocator& operator= ( const StackAllocator< Type, Size > &  )
defaultnoexcept

copy-assignment: default

◆ operator=() [2/2]

StackAllocator& operator= ( StackAllocator< Type, Size > &&  )
defaultnoexcept

move-assignment: default

◆ operator==()

bool operator== ( const StackAllocator< Other, OtherSize > &  other) const
inlinenoexcept

Definition at line 169 of file stack_allocator.hpp.

References StackAllocator< Type, Size >::arena_.

Member Data Documentation

◆ arena_

StackArena<Size>* arena_
private

Definition at line 184 of file stack_allocator.hpp.

Referenced by StackAllocator< Type, Size >::operator==().


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