From 5f7133f44990cb10b9332e90fbe32ba72a6ecb12 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Mon, 26 Feb 2024 13:20:19 +0100 Subject: [PATCH] Added parameter const attributes --- Matrix.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Matrix.h b/Matrix.h index b9b9d18..314b0a0 100644 --- a/Matrix.h +++ b/Matrix.h @@ -7,7 +7,7 @@ template class MatrixOf { public: MatrixOf(unsigned int rows, unsigned int cols); - MatrixOf(unsigned int rows, unsigned int cols, T *source) + MatrixOf(unsigned int rows, unsigned int cols, const T *source) : MatrixOf(rows, cols) { Set(source); } @@ -60,7 +60,7 @@ public: static Vector3 Multiply(const MatrixOf *m, Vector3 v); Vector3 operator*(const Vector3 v) const; - T Get(unsigned int rowIx, unsigned int colIx) { + T Get(unsigned int rowIx, unsigned int colIx) const { unsigned int dataIx = rowIx * this->cols + colIx; return this->data[dataIx]; } @@ -71,7 +71,7 @@ public: } // This function does not check on source size! - void Set(T *source) { + void Set(const T *source) { unsigned int matrixSize = this->cols * this->rows; for (unsigned int dataIx = 0; dataIx < matrixSize; dataIx++) this->data[dataIx] = source[dataIx];