7#ifndef DATA_STRUCTURES_STACK_HPP_
8#define DATA_STRUCTURES_STACK_HPP_
18template <
class ValueType>
21 using value_type = ValueType;
25 std::cout <<
"Top --> ";
28 std::cout <<
"Size of stack: " <<
size << std::endl;
31 std::vector<value_type> toVector()
const {
32 return push_all_to_vector(this->
stackTop.get(), this->size);
36 void ensureNotEmpty()
const {
38 throw std::invalid_argument(
"Stack is empty.");
47 void push(
const value_type& item) {
48 auto newNode = std::make_shared<Node<value_type>>();
56 value_type
top()
const {
for std::invalid_argument
std::size_t size
size of stack
bool isEmptyStack() const
void push(const value_type &item)
std::shared_ptr< Node< value_type > > stackTop
Provides Node class and related utilities.