|
| Stack () |
| Default constructor.
|
|
| Stack (int n) |
| Create a Stack of size n .
|
|
| Stack (const Stack< T > &s) |
| Create a copy of s .
|
|
virtual | ~Stack () |
| Default destructor.
|
|
T | pop () |
| Pop the topmost element of the stack.
|
|
T | peek () const |
| Peek at the topmost element of the stack, without removing it.
|
|
void | push (T v) |
| Push an element at top of stack.
|
|
void | clear () |
| Empty the stack.
|
|
void | operator= (const Stack< T > &s) |
| Assignment operator.
|
|
int | size () const |
| Returns the maximum number of data elements the stack can store.
|
|
int | no_elements () const |
| Returns the number of data elements currently in the stack.
|
|
void | set_size (int n, bool copy=false) |
| Resizing a Stack<T>.
|
|
template<class T>
class itpp::Stack< T >
General stack class.
This class is a general stack class for arbitrary types.
For rarely used types you will need to instantiate the class by
The following example shows how to define a Stack of vectors:
my_stack.push(a);
my_stack.push(b);
cout << my_stack.pop() << " " << my_stack.pop() << endl ;
double randn(void)
Generates a random Gaussian (0,1) variable.
Definition at line 66 of file stack.h.