Add MatrixOf::CopyFrom
This commit is contained in:
parent
5f7133f449
commit
c01640429c
14
Matrix.h
14
Matrix.h
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user