CatapultServer  v0.5.0.1 (Elephant)
catapult::state::CompactArrayStack< T, N > Class Template Reference

Compact array-based stack that allocates memory dynamically only when it is not empty. More...

Classes

class  const_iterator
 

Public Member Functions

 CompactArrayStack ()
 Creates an empty stack. More...
 
 CompactArrayStack (const CompactArrayStack &stack)
 Copy constructor that makes a deep copy of stack. More...
 
 CompactArrayStack (CompactArrayStack &&stack)
 Move constructor that move constructs a stack from stack. More...
 
CompactArrayStackoperator= (const CompactArrayStack &stack)
 Assignment operator that makes a deep copy of stack. More...
 
CompactArrayStackoperator= (CompactArrayStack &&stack)
 Move assignment operator that assigns stack. More...
 
size_t size () const
 Gets number of non-default values contained in the stack. More...
 
const_iterator begin () const
 Returns a const iterator to the first element of the underlying container. More...
 
const_iterator end () const
 Returns a const iterator to the element following the last element of the underlying container. More...
 
const T & peek () const
 Returns a const reference to the element on the top of the stack. More...
 
T & peek ()
 Returns a reference to the element on the top of the stack. More...
 
void push (const T &value)
 Pushes value onto the stack. More...
 
void pop ()
 Pops the top value from the stack. More...
 

Private Member Functions

void shiftLeft ()
 
void shiftRight ()
 

Private Attributes

std::unique_ptr< std::array< T, N > > m_pArray
 
size_t m_size
 

Detailed Description

template<typename T, size_t N>
class catapult::state::CompactArrayStack< T, N >

Compact array-based stack that allocates memory dynamically only when it is not empty.

Constructor & Destructor Documentation

◆ CompactArrayStack() [1/3]

template<typename T, size_t N>
catapult::state::CompactArrayStack< T, N >::CompactArrayStack ( )
inline

Creates an empty stack.

◆ CompactArrayStack() [2/3]

template<typename T, size_t N>
catapult::state::CompactArrayStack< T, N >::CompactArrayStack ( const CompactArrayStack< T, N > &  stack)
inline

Copy constructor that makes a deep copy of stack.

◆ CompactArrayStack() [3/3]

template<typename T, size_t N>
catapult::state::CompactArrayStack< T, N >::CompactArrayStack ( CompactArrayStack< T, N > &&  stack)
inline

Move constructor that move constructs a stack from stack.

Member Function Documentation

◆ begin()

template<typename T, size_t N>
const_iterator catapult::state::CompactArrayStack< T, N >::begin ( ) const
inline

Returns a const iterator to the first element of the underlying container.

Here is the caller graph for this function:

◆ end()

template<typename T, size_t N>
const_iterator catapult::state::CompactArrayStack< T, N >::end ( ) const
inline

Returns a const iterator to the element following the last element of the underlying container.

Here is the caller graph for this function:

◆ operator=() [1/2]

template<typename T, size_t N>
CompactArrayStack& catapult::state::CompactArrayStack< T, N >::operator= ( CompactArrayStack< T, N > &&  stack)
inline

Move assignment operator that assigns stack.

◆ operator=() [2/2]

template<typename T, size_t N>
CompactArrayStack& catapult::state::CompactArrayStack< T, N >::operator= ( const CompactArrayStack< T, N > &  stack)
inline

Assignment operator that makes a deep copy of stack.

◆ peek() [1/2]

template<typename T, size_t N>
T& catapult::state::CompactArrayStack< T, N >::peek ( )
inline

Returns a reference to the element on the top of the stack.

◆ peek() [2/2]

template<typename T, size_t N>
const T& catapult::state::CompactArrayStack< T, N >::peek ( ) const
inline

Returns a const reference to the element on the top of the stack.

Here is the caller graph for this function:

◆ pop()

template<typename T, size_t N>
void catapult::state::CompactArrayStack< T, N >::pop ( )
inline

Pops the top value from the stack.

Here is the caller graph for this function:

◆ push()

template<typename T, size_t N>
void catapult::state::CompactArrayStack< T, N >::push ( const T &  value)
inline

Pushes value onto the stack.

Here is the caller graph for this function:

◆ shiftLeft()

template<typename T, size_t N>
void catapult::state::CompactArrayStack< T, N >::shiftLeft ( )
inlineprivate
Here is the caller graph for this function:

◆ shiftRight()

template<typename T, size_t N>
void catapult::state::CompactArrayStack< T, N >::shiftRight ( )
inlineprivate
Here is the caller graph for this function:

◆ size()

template<typename T, size_t N>
size_t catapult::state::CompactArrayStack< T, N >::size ( ) const
inline

Gets number of non-default values contained in the stack.

Member Data Documentation

◆ m_pArray

template<typename T, size_t N>
std::unique_ptr<std::array<T, N> > catapult::state::CompactArrayStack< T, N >::m_pArray
private

◆ m_size

template<typename T, size_t N>
size_t catapult::state::CompactArrayStack< T, N >::m_size
private

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