This class provides a stack container that processes data elements based on the "Last in - First out" principle.
More...
|
| | Stack () |
| | Constructor for the stack. Initializes all variables.
|
| |
| | ~Stack () |
| | Destructor for the stack. Here all variables are deleted.
|
| |
| bool | hasElements () const |
| | This method returns true if the stack is not empty.
|
| |
| T | pop () |
| | Removes and returns the top element from the stack.
|
| |
| T & | top () const |
| | Returns the top element of the stack without removing it.
|
| |
| T * | topRef () |
| | Returns the top element of the stack without removing it.
|
| |
| T | top2 () |
| | Returns the second top element of the stack without removing it.
|
| |
| T | top3 () |
| | Returns the third element from the top of the stack without removing it.
|
| |
| void | push (T data) |
| | Adds an element to the stack.
|
| |
| void | clear () |
| | Deletes all elements on the stack.
|
| |
| size_t | size () const |
| | Returns the number of elements on the stack.
|
| |
| void | reverse () |
| | Reverses the order of the stack. The bottom element becomes the top.
|
| |
template<class T>
class jm::Stack< T >
This class provides a stack container that processes data elements based on the "Last in - First out" principle.
The Stack class allows elements to be added and removed from the top of the stack, maintaining the order in which they were added.
- Template Parameters
-
| T | The type of data elements stored in the stack. |