7#ifndef DATA_STRUCTURES_STACK_HPP_
8#define DATA_STRUCTURES_STACK_HPP_
18template <
class ValueType>
25template <
typename Node,
typename Action>
26void traverse(
const Node*
const inNode,
const Action& action) {
29 traverse(inNode->next.get(), action);
37template <
class ValueType>
40 using value_type = ValueType;
46 std::cout << inNode.data <<
" ";
56 res.push_back(inNode.data);
62 void ensureNotEmpty()
const {
73 void push(
const value_type& item) {
74 auto newNode = std::make_shared<node<value_type>>();
82 value_type
top()
const {
std::size_t size
size of stack
Definition: stack.hpp:103
bool isEmptyStack() const
Definition: stack.hpp:70
void pop()
Definition: stack.hpp:88
void clear()
Definition: stack.hpp:95
void display() const
Definition: stack.hpp:43
void push(const value_type &item)
Definition: stack.hpp:73
std::shared_ptr< node< value_type > > stackTop
Definition: stack.hpp:101
value_type top() const
Definition: stack.hpp:82
Definition: linkedlist_implentation_usingarray.cpp:14
for std::vector
Definition: avltree.cpp:13