V-Gears 0
Free Final Fantasy VII engine.
Stack< T > Class Template Reference

Stack class based on a deque. More...

#include <Stack.h>

Public Member Functions

bool IsEmpty () const
 Returns whether or not the stack is empty. More...
 
void Push (const T &item)
 Push an item onto the stack. More...
 
Pop ()
 Pop an item from the stack and return it. More...
 
T & Peek ()
 Return the topmost item on the stack without removing it. More...
 
const T & Peek () const
 Return the topmost item on the stack without removing it. More...
 
T & PeekPos (size_t pos)
 Gets item on a specified stack position without removing it. More...
 
const T & PeekPos (size_t pos) const
 Gets item on a specified stack position without removing it. More...
 

Private Attributes

std::deque< T > stack_
 The stack. More...
 

Detailed Description

template<typename T>
class Stack< T >

Stack class based on a deque.

Member Function Documentation

◆ IsEmpty()

template<typename T >
bool Stack< T >::IsEmpty ( ) const
inline

Returns whether or not the stack is empty.

Returns
True if the stack is empty, false if it is not.

◆ Peek() [1/2]

template<typename T >
T & Stack< T >::Peek ( )
inline

Return the topmost item on the stack without removing it.

Returns
The topmost item on the stack.

◆ Peek() [2/2]

template<typename T >
const T & Stack< T >::Peek ( ) const
inline

Return the topmost item on the stack without removing it.

Returns
The topmost item on the stack.

◆ PeekPos() [1/2]

template<typename T >
T & Stack< T >::PeekPos ( size_t  pos)
inline

Gets item on a specified stack position without removing it.

Parameters
[in]posThe number of items to skip on the stack.
Returns
The desired item from the stack.

◆ PeekPos() [2/2]

template<typename T >
const T & Stack< T >::PeekPos ( size_t  pos) const
inline

Gets item on a specified stack position without removing it.

Parameters
[in]posThe number of items to skip on the stack.
Returns
The desired item from the stack.

◆ Pop()

template<typename T >
T Stack< T >::Pop ( )
inline

Pop an item from the stack and return it.

Returns
The value popped from the stack.

◆ Push()

template<typename T >
void Stack< T >::Push ( const T &  item)
inline

Push an item onto the stack.

Parameters
[in]itemThe item to push.

Member Data Documentation

◆ stack_

template<typename T >
std::deque<T> Stack< T >::stack_
private

The stack.


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