#include "string_matrix.hpp" StringMatrix::StringMatrix(const Bounds &bounds) : _rows(bounds.get_height()), _columns(bounds.get_width()) { _matrix.reserve(bounds.get_height()); _matrix.assign(_matrix.capacity(), std::vector(bounds.get_width())); }; void StringMatrix::fill(std::string_view 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; } } } std::string_view StringMatrix::get(const Vector2 &pos) const { return _matrix[pos.get_y()][pos.get_x()]; } void StringMatrix::set(const Vector2 &pos, std::string_view element) { _matrix[pos.get_y()][pos.get_x()] = element; } unsigned int StringMatrix::rows() const { return _rows; } unsigned int StringMatrix::columns() const { return _columns; }