mCRL2
Loading...
Searching...
No Matches
mcrl2::utilities::stack_array< T > Class Template Reference

Provides (a subset of) the interface of std::array<T> for a portion of preallocated memory. Can be used to interface with a portion of memory allocated on the stack,. More...

#include <stack_array.h>

Inheritance diagram for mcrl2::utilities::stack_array< T >:
mcrl2::utilities::noncopyable

Public Types

using iterator = T *
 
using const_iterator = const T *
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 

Public Member Functions

 stack_array (T *reserved_memory, std::size_t N)
 The given pointer should be able to hold N element of sizeof(T) bytes.
 
 ~stack_array ()
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
T * data ()
 
const T * data () const
 
bool empty () const
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
std::size_t size () const
 
std::size_t max_size () const
 
T & operator[] (std::size_t index)
 
- Public Member Functions inherited from mcrl2::utilities::noncopyable
 noncopyable ()=default
 
 noncopyable (const noncopyable &)=delete
 
noncopyableoperator= (const noncopyable &)=delete
 

Private Attributes

T * m_reserved_memory
 
std::size_t m_size
 

Detailed Description

template<typename T>
class mcrl2::utilities::stack_array< T >

Provides (a subset of) the interface of std::array<T> for a portion of preallocated memory. Can be used to interface with a portion of memory allocated on the stack,.

See also
MCRL2_DECLARE_STACK_ARRAY. The advantage over MCRL2_SPECIFIC_STACK_ALLOCATOR is that the lifetime of the underlying objects is bounded by the lifetime of the stack_array.

Definition at line 29 of file stack_array.h.

Member Typedef Documentation

◆ const_iterator

template<typename T >
using mcrl2::utilities::stack_array< T >::const_iterator = const T*

Definition at line 33 of file stack_array.h.

◆ const_reverse_iterator

template<typename T >
using mcrl2::utilities::stack_array< T >::const_reverse_iterator = std::reverse_iterator<const_iterator>

Definition at line 35 of file stack_array.h.

◆ iterator

template<typename T >
using mcrl2::utilities::stack_array< T >::iterator = T*

Definition at line 32 of file stack_array.h.

◆ reverse_iterator

template<typename T >
using mcrl2::utilities::stack_array< T >::reverse_iterator = std::reverse_iterator<iterator>

Definition at line 34 of file stack_array.h.

Constructor & Destructor Documentation

◆ stack_array()

template<typename T >
mcrl2::utilities::stack_array< T >::stack_array ( T *  reserved_memory,
std::size_t  N 
)
inline

The given pointer should be able to hold N element of sizeof(T) bytes.

Definition at line 38 of file stack_array.h.

◆ ~stack_array()

template<typename T >
mcrl2::utilities::stack_array< T >::~stack_array ( )
inline

Definition at line 48 of file stack_array.h.

Member Function Documentation

◆ begin() [1/2]

template<typename T >
iterator mcrl2::utilities::stack_array< T >::begin ( )
inline

Definition at line 58 of file stack_array.h.

◆ begin() [2/2]

template<typename T >
const_iterator mcrl2::utilities::stack_array< T >::begin ( ) const
inline

Definition at line 59 of file stack_array.h.

◆ data() [1/2]

template<typename T >
T * mcrl2::utilities::stack_array< T >::data ( )
inline

Definition at line 64 of file stack_array.h.

◆ data() [2/2]

template<typename T >
const T * mcrl2::utilities::stack_array< T >::data ( ) const
inline

Definition at line 65 of file stack_array.h.

◆ empty()

template<typename T >
bool mcrl2::utilities::stack_array< T >::empty ( ) const
inline

Definition at line 67 of file stack_array.h.

◆ end() [1/2]

template<typename T >
iterator mcrl2::utilities::stack_array< T >::end ( )
inline

Definition at line 61 of file stack_array.h.

◆ end() [2/2]

template<typename T >
const_iterator mcrl2::utilities::stack_array< T >::end ( ) const
inline

Definition at line 62 of file stack_array.h.

◆ max_size()

template<typename T >
std::size_t mcrl2::utilities::stack_array< T >::max_size ( ) const
inline

Definition at line 77 of file stack_array.h.

◆ operator[]()

template<typename T >
T & mcrl2::utilities::stack_array< T >::operator[] ( std::size_t  index)
inline

Definition at line 79 of file stack_array.h.

◆ rbegin() [1/2]

template<typename T >
reverse_iterator mcrl2::utilities::stack_array< T >::rbegin ( )
inline

Definition at line 69 of file stack_array.h.

◆ rbegin() [2/2]

template<typename T >
const_reverse_iterator mcrl2::utilities::stack_array< T >::rbegin ( ) const
inline

Definition at line 70 of file stack_array.h.

◆ rend() [1/2]

template<typename T >
reverse_iterator mcrl2::utilities::stack_array< T >::rend ( )
inline

Definition at line 72 of file stack_array.h.

◆ rend() [2/2]

template<typename T >
const_reverse_iterator mcrl2::utilities::stack_array< T >::rend ( ) const
inline

Definition at line 73 of file stack_array.h.

◆ size()

template<typename T >
std::size_t mcrl2::utilities::stack_array< T >::size ( ) const
inline

Definition at line 75 of file stack_array.h.

Member Data Documentation

◆ m_reserved_memory

template<typename T >
T* mcrl2::utilities::stack_array< T >::m_reserved_memory
private

Definition at line 86 of file stack_array.h.

◆ m_size

template<typename T >
std::size_t mcrl2::utilities::stack_array< T >::m_size
private

Definition at line 87 of file stack_array.h.


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