Data Structures Class Templates
Various data structures implemented using c++ class templates.
stack.h
Go to the documentation of this file.
1 #pragma once
2 
14 template <typename T>
15 class Stack {
16  T* arr;
17  size_t s_size;
18  size_t top;
20 public:
27  Stack (size_t s=10);
28 
34  ~Stack ();
35 
42  void push (T value);
43 
50  T pop ();
51 
58  T stacktop ();
59 
65  bool isEmpty ();
66 
72  void display ();
73 };
74 
75 #include "stack_impl.h"
Stack::~Stack
~Stack()
Destructor.
Definition: stack_impl.h:19
Stack::isEmpty
bool isEmpty()
Member function for checking if stack is empty.
stack_impl.h
Contains implementation of the Stack class template.
Stack::push
void push(T value)
Member function to push data into the stack.
Definition: stack_impl.h:27
Stack::display
void display()
Member function for displaying the stack.
Definition: stack_impl.h:48
Stack::Stack
Stack(size_t s=10)
Constructor.
Definition: stack_impl.h:13
Stack::stacktop
T stacktop()
Member function which returns element at top of the stack.
Definition: stack_impl.h:41
Stack
Class template for stack data type.
Definition: stack.h:15
Stack::pop
T pop()
Member function which removes and returns element at the top of the stack.
Definition: stack_impl.h:34