General stack class. More...
#include <itpp/base/stack.h>
Public Member Functions | |
| Stack () | |
| Default constructor. More... | |
| Stack (int n) | |
Create a Stack of size n. More... | |
| Stack (const Stack< T > &s) | |
Create a copy of s. More... | |
| virtual | ~Stack () |
| Default destructor. More... | |
| T | pop () |
| Pop the topmost element of the stack. More... | |
| T | peek () const |
| Peek at the topmost element of the stack, without removing it. More... | |
| void | push (T v) |
| Push an element at top of stack. More... | |
| void | clear () |
| Empty the stack. More... | |
| void | operator= (const Stack< T > &s) |
| Assignment operator. More... | |
| int | size () const |
| Returns the maximum number of data elements the stack can store. More... | |
| int | no_elements () const |
| Returns the number of data elements currently in the stack. More... | |
| void | set_size (int n, bool copy=false) |
| Resizing a Stack<T>. More... | |
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:
| itpp::Stack< T >::Stack |
| itpp::Stack< T >::Stack | ( | int | n | ) |
| itpp::Stack< T >::Stack | ( | const Stack< T > & | s | ) |
|
virtual |
| T itpp::Stack< T >::pop |
Pop the topmost element of the stack.
Definition at line 142 of file stack.h.
References it_error_if.
| T itpp::Stack< T >::peek |
Peek at the topmost element of the stack, without removing it.
Definition at line 150 of file stack.h.
References it_error_if.
| void itpp::Stack< T >::push | ( | T | v | ) |
| void itpp::Stack< T >::clear |
| void itpp::Stack< T >::operator= | ( | const Stack< T > & | s | ) |
|
inline |
|
inline |
| void itpp::Stack< T >::set_size | ( | int | n, |
| bool | copy = false |
||
| ) |
Generated on Wed Mar 30 2022 00:00:00 for IT++ by Doxygen 1.9.3