In file ..\..\src\Pegasus\Common\Stack.h:

template<class T> class Stack

The Stack class provides a simple stack implementation.

Documentation

The Stack class provides a simple stack implementation. This class provides a stack implementation which is based on the Array<> template class.

Inheritance:


Public Methods

[more] Stack ()
Default constructor.
[more] Stack (const Stack<T>& x)
Copy constructor.
[more]PEGASUS_EXPLICIT Stack (const T& x)
This constructor was added to provide a fast way of creating a stack with a single element on it.
[more] ~Stack ()
Destructor.
[more]Stack<T> & operator= (const Stack<T>& x)
Assignment operator.
[more]Uint32 size () const
Returns size of stack.
[more]Boolean isEmpty () const
Tests whether stack is empty.
[more]void push (const T& x)
Pushes entry onto the stack.
[more]T& top ()
Returns reference to the top element on the stack.
[more]const T& top () const
Const version of top() method
[more]void pop ()
Pops top entry from stack.
[more]T& operator[] (Uint32 i)
Provides indexing for stack.
[more]const T& operator[] (Uint32 i) const
Const version of indxing operator.

o Stack()
Default constructor.

o Stack(const Stack<T>& x)
Copy constructor.

oPEGASUS_EXPLICIT Stack(const T& x)
This constructor was added to provide a fast way of creating a stack with a single element on it. This constructor is necessary to realize the return-value compiler optimization which permits objects used in return/constructor expressions to be initialized only once.

Notice that this constructor is explicit to avoid implicit initialization of a stack with the type of T. which

o ~Stack()
Destructor.

oStack<T> & operator=(const Stack<T>& x)
Assignment operator.

oUint32 size() const
Returns size of stack.

oBoolean isEmpty() const
Tests whether stack is empty.

ovoid push(const T& x)
Pushes entry onto the stack.

oT& top()
Returns reference to the top element on the stack.
Throws:
throws StackUnderflow if stack is empty.
Returns:
reference to top element on stack.

oconst T& top() const
Const version of top() method

ovoid pop()
Pops top entry from stack.

oT& operator[](Uint32 i)
Provides indexing for stack.

oconst T& operator[](Uint32 i) const
Const version of indxing operator.


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java