|
Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
Class representation of a stack. More...
Public Member Functions | |
| Stack (int size) | |
| Constructs a new Stack object. | |
| bool | full () const |
| Checks if the stack is full. | |
| bool | empty () const |
| Checks if the stack is empty. | |
| void | push (T element) |
| Pushes an element onto the stack. | |
| T | pop () |
| Pops an element from the stack. | |
| void | show () const |
| Displays all elements in the stack. | |
| T | topmost () const |
| Displays the topmost element of the stack. | |
| T | bottom () const |
| Displays the bottom element of the stack. | |
Private Attributes | |
| std::unique_ptr< T[]> | stack |
| Smart pointer to the stack array. | |
| int | stackSize |
| Maximum size of the stack. | |
| int | stackIndex |
| Index pointing to the top element of the stack. | |
Class representation of a stack.
| T | The type of the elements in the stack |
|
inline |
Constructs a new Stack object.
| size | Maximum size of the stack |
|
inline |
Displays the bottom element of the stack.
| std::out_of_range | if the stack is empty |
|
inline |
Checks if the stack is empty.
|
inline |
Checks if the stack is full.
|
inline |
Pops an element from the stack.
| std::out_of_range | if the stack is empty |
|
inline |
Pushes an element onto the stack.
| element | Element to push onto the stack |
|
inline |
Displays all elements in the stack.
|
inline |
Displays the topmost element of the stack.
| std::out_of_range | if the stack is empty |