From 9147551cd21d565f9503e3ebbcd2121e284d88d5 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 13 Feb 2022 20:55:06 +0100 Subject: style: fix curly positions & delete unused include --- src/engine/matrix.tpp | 4 ++++ src/stack.tpp | 6 ++++++ src/utils.hpp | 1 - 3 files changed, 10 insertions(+), 1 deletion(-) 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::fill(Element element) std::vector row_vector = _matrix[row]; for (unsigned int column = 0U; column < row_vector.capacity(); column++) + { _matrix[row][column] = element; + } } } @@ -29,7 +31,9 @@ void Matrix::print() for (std::vector 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 void Stack::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 void Stack::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 Item Stack::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 #include /** -- cgit v1.2.3-18-g5258