Try constructing & initializing the matrix in one step.

This uses multi_type_matrix's new constructor that allows array data
assignment.

Change-Id: Ief01aefc1cc770aca702de7117c7e72c51fd4c33
This commit is contained in:
Kohei Yoshida
2013-10-18 19:49:14 -04:00
parent 790aec7e84
commit a130c38bbc

View File

@@ -122,11 +122,11 @@ class CompareMatrixElemFunc : std::unary_function<MatrixImplType::element_block_
{ {
static _Comp maComp; static _Comp maComp;
MatrixImplType maNewMat;
std::vector<bool> maNewMatValues; std::vector<bool> maNewMatValues;
size_t mnRow;
size_t mnCol;
public: public:
CompareMatrixElemFunc( size_t nRow, size_t nCol ) : CompareMatrixElemFunc( size_t nRow, size_t nCol ) : mnRow(nRow), mnCol(nCol)
maNewMat(nRow, nCol, false)
{ {
maNewMatValues.reserve(nRow*nCol); maNewMatValues.reserve(nRow*nCol);
} }
@@ -178,8 +178,8 @@ public:
void swap( MatrixImplType& rMat ) void swap( MatrixImplType& rMat )
{ {
maNewMat.set(0, 0, maNewMatValues.begin(), maNewMatValues.end()); MatrixImplType aNewMat(mnRow, mnCol, maNewMatValues.begin(), maNewMatValues.end());
rMat.swap(maNewMat); rMat.swap(aNewMat);
} }
}; };