aboutsummaryrefslogtreecommitdiff
path: root/src/engine/matrix.tpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/matrix.tpp')
-rw-r--r--src/engine/matrix.tpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/engine/matrix.tpp b/src/engine/matrix.tpp
index bddf76a..d25de28 100644
--- a/src/engine/matrix.tpp
+++ b/src/engine/matrix.tpp
@@ -1,14 +1,15 @@
+#pragma once
+
#include "matrix.hpp"
+
#include <iostream>
template <typename Element>
-Matrix<Element>::Matrix(unsigned int rows, unsigned int columns)
+Matrix<Element>::Matrix(const Bounds &bounds)
+ : _rows(bounds.height()), _columns(bounds.width())
{
- _rows = rows;
- _columns = columns;
-
- _matrix.reserve(rows);
- _matrix.assign(_matrix.capacity(), std::vector<Element>(columns));
+ _matrix.reserve(bounds.height());
+ _matrix.assign(_matrix.capacity(), std::vector<Element>(bounds.width()));
};
template <typename Element>
@@ -28,9 +29,9 @@ void Matrix<Element>::fill(Element element)
template <typename Element>
void Matrix<Element>::print()
{
- for (std::vector<Element> row : _matrix)
+ for (const std::vector<Element> &row : _matrix)
{
- for (Element element : row)
+ for (const Element &element : row)
{
std::cout << element;
}