#pragma once #include "matrix.hpp" #include template Matrix::Matrix(const Bounds &bounds) : _rows(bounds.height()), _columns(bounds.width()) { _matrix.reserve(bounds.height()); _matrix.assign(_matrix.capacity(), std::vector(bounds.width())); }; template void Matrix::fill(Element element) { for (unsigned int row = 0U; row < _matrix.capacity(); row++) { std::vector row_vector = _matrix[row]; for (unsigned int column = 0U; column < row_vector.capacity(); column++) { _matrix[row][column] = element; } } } template void Matrix::print() { for (const std::vector &row : _matrix) { for (const Element &element : row) { std::cout << element; } std::cout << "\n"; } std::cout << std::flush; } template Element Matrix::get(Vector2 pos) { return _matrix[pos.y()][pos.x()]; } template void Matrix::set(Vector2 pos, Element element) { _matrix[pos.y()][pos.x()] = element; } template unsigned int Matrix::rows() { return _rows; } template unsigned int Matrix::columns() { return _columns; }