aboutsummaryrefslogtreecommitdiff
path: root/src/stack.tpp
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-02-15 20:27:51 +0100
committerHampusM <hampus@hampusmat.com>2022-02-15 20:27:51 +0100
commit5dae8f8d10d506abc3c75a1f66c1dfe620c84fc1 (patch)
tree2bfb6efef0535a35bab1da811a5f69cb5203dff9 /src/stack.tpp
parent9147551cd21d565f9503e3ebbcd2121e284d88d5 (diff)
refactor: improve project design
Diffstat (limited to 'src/stack.tpp')
-rw-r--r--src/stack.tpp42
1 files changed, 0 insertions, 42 deletions
diff --git a/src/stack.tpp b/src/stack.tpp
deleted file mode 100644
index b555a49..0000000
--- a/src/stack.tpp
+++ /dev/null
@@ -1,42 +0,0 @@
-#include "stack.hpp"
-#include <iostream>
-#include <stdexcept>
-
-template <typename Item>
-Stack<Item>::Stack(unsigned long capacity)
-{
- _items.reserve(capacity);
-}
-
-template <typename Item>
-void Stack<Item>::push(Item item)
-{
- if (_items.size() == _items.capacity())
- {
- throw std::overflow_error("Tried to push when stack is full");
- }
-
- _items.push_back(item);
-}
-
-template <typename Item>
-void Stack<Item>::pop()
-{
- if (_items.size() == 0)
- {
- throw std::underflow_error("Tried to pop when stack size is 0");
- }
-
- _items.pop_back();
-}
-
-template <typename Item>
-Item Stack<Item>::peek()
-{
- if (_items.size() == 0)
- {
- throw std::underflow_error("Tried to peek when stack size is 0");
- }
-
- return _items.back();
-}