aboutsummaryrefslogtreecommitdiff
path: root/src/stack.tpp
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-02-13 20:55:06 +0100
committerHampusM <hampus@hampusmat.com>2022-02-13 20:55:06 +0100
commit9147551cd21d565f9503e3ebbcd2121e284d88d5 (patch)
tree029eb769eee4653a5d318881501a0358d1ae2927 /src/stack.tpp
parent176d6141c87a180b251bacaee656808bad17498b (diff)
style: fix curly positions & delete unused include
Diffstat (limited to 'src/stack.tpp')
-rw-r--r--src/stack.tpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/stack.tpp b/src/stack.tpp
index 405d493..b555a49 100644
--- a/src/stack.tpp
+++ b/src/stack.tpp
@@ -12,7 +12,9 @@ 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);
}
@@ -21,7 +23,9 @@ 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();
}
@@ -30,7 +34,9 @@ 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();
}