diff --git a/Matrix.cpp b/Matrix.cpp index b725f55..f2daff0 100644 --- a/Matrix.cpp +++ b/Matrix.cpp @@ -1,5 +1,7 @@ #include "Matrix.h" +#if !defined(NO_STD) #include +#endif namespace LinearAlgebra { @@ -61,7 +63,9 @@ Matrix2::Matrix2(const Matrix2& m) this->data = nullptr; else { this->data = new float[this->nValues]; - std::copy(m.data, m.data + nValues, this->data); + + for (int ix = 0; ix < this->nValues; ++ix) + this->data[ix] = m.data[ix]; } } @@ -76,7 +80,8 @@ Matrix2& Matrix2::operator=(const Matrix2& m) { this->data = nullptr; else { this->data = new float[this->nValues]; - std::copy(m.data, m.data + this->nValues, this->data); + for (int ix = 0; ix < this->nValues; ++ix) + this->data[ix] = m.data[ix]; } } return *this; @@ -89,7 +94,8 @@ Matrix2::~Matrix2() { Matrix2 Matrix2::Clone() const { Matrix2 r = Matrix2(this->nRows, this->nCols); - std::copy(this->data, this->data + this->nValues, r.data); + for (int ix = 0; ix < this->nValues; ++ix) + r.data[ix] = this->data[ix]; return r; } @@ -158,8 +164,8 @@ Matrix2 Matrix2::SkewMatrix(const Vector3& v) { Matrix2 Matrix2::Transpose() const { Matrix2 r = Matrix2(this->nCols, this->nRows); - for (uint rowIx = 0; rowIx < this->nRows; rowIx++) { - for (uint colIx = 0; colIx < this->nCols; colIx++) + for (int rowIx = 0; rowIx < this->nRows; rowIx++) { + for (int colIx = 0; colIx < this->nCols; colIx++) r.data[colIx * this->nCols + rowIx] = this->data[rowIx * this->nCols + colIx]; }