diff options
author | HampusM <hampus@hampusmat.com> | 2022-02-13 20:55:06 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-02-13 20:55:06 +0100 |
commit | 9147551cd21d565f9503e3ebbcd2121e284d88d5 (patch) | |
tree | 029eb769eee4653a5d318881501a0358d1ae2927 | |
parent | 176d6141c87a180b251bacaee656808bad17498b (diff) |
style: fix curly positions & delete unused include
-rw-r--r-- | src/engine/matrix.tpp | 4 | ||||
-rw-r--r-- | src/stack.tpp | 6 | ||||
-rw-r--r-- | src/utils.hpp | 1 |
3 files changed, 10 insertions, 1 deletions
diff --git a/src/engine/matrix.tpp b/src/engine/matrix.tpp index b9fa495..bddf76a 100644 --- a/src/engine/matrix.tpp +++ b/src/engine/matrix.tpp @@ -19,7 +19,9 @@ void Matrix<Element>::fill(Element element) std::vector<Element> row_vector = _matrix[row]; for (unsigned int column = 0U; column < row_vector.capacity(); column++) + { _matrix[row][column] = element; + } } } @@ -29,7 +31,9 @@ void Matrix<Element>::print() for (std::vector<Element> row : _matrix) { for (Element element : row) + { std::cout << element; + } std::cout << "\n"; } 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(); } diff --git a/src/utils.hpp b/src/utils.hpp index e98d52f..be299c7 100644 --- a/src/utils.hpp +++ b/src/utils.hpp @@ -1,6 +1,5 @@ #pragma once -#include <memory> #include <string> /** |