scire
Sadh's C++ Impromptu Routines Ensemble
|
Linked list implementation of stack. More...
#include <stack.hpp>
Public Member Functions | |
Stack () | |
initialize a Stack object, with top pointing to nullptr More... | |
~Stack () | |
finalize a Stack object by deleting all items from it More... | |
bool | Push (const Type &element) |
Push a new element at the top of stack. More... | |
bool | Pop () |
Pop (remove/deduce) an element from the top. More... | |
Type | Top () const |
Access the top element of stack. More... | |
SzType | Size () const |
number of elements contained in More... | |
bool | Add (const Type &element) |
add an element More... | |
bool | Deduce () |
deduce one element More... | |
Type | Peek () const |
peek into next element contained in More... | |
virtual bool | IsEmpty () const |
check if empty More... | |
Linked list implementation of stack.
Stack implemented as linked items. A top pointer points to first item in the stack. Each item points to next item of it and the last item points to nullptr. Items can be added (push) and removed (pop) at top of the stack.
scire::Stack< Type, SzType >::Stack | ( | ) |
scire::Stack< Type, SzType >::~Stack | ( | ) |
|
inlinevirtualinherited |
add an element
element | element to be added as new element |
Implements scire::AContainer< Type, SzType >.
|
inlinevirtualinherited |
|
inlinevirtualinherited |
|
inlinevirtualinherited |
|
virtual |
Pop (remove/deduce) an element from the top.
Implements scire::AStack< Type, SzType >.
|
virtual |
Push a new element at the top of stack.
element | element to push |
Implements scire::AStack< Type, SzType >.
|
virtual |
|
virtual |
Access the top element of stack.
Implements scire::AStack< Type, SzType >.