Add MatrixOf::CopyFrom

This commit is contained in:
Pascal Serrarens 2024-02-27 14:41:31 +01:00
parent 5f7133f449
commit c01640429c

View File

@ -92,8 +92,18 @@ public:
this->data[dataIx] = source[sourceIx];
}
unsigned int RowCount() { return rows; }
unsigned int ColCount() { return cols; }
void CopyFrom(const MatrixOf<T> *m) {
unsigned int thisMatrixSize = this->cols * this->rows;
unsigned int mMatrixSize = m->cols * m->rows;
if (mMatrixSize != thisMatrixSize)
return;
for (unsigned int dataIx = 0; dataIx < thisMatrixSize; dataIx++)
this->data[dataIx] = m->data[dataIx];
}
unsigned int RowCount() const { return rows; }
unsigned int ColCount() const { return cols; }
private:
unsigned int rows;