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;
MatrixImplType maNewMat;
std::vector<bool> maNewMatValues;
size_t mnRow;
size_t mnCol;
public:
CompareMatrixElemFunc( size_t nRow, size_t nCol ) :
maNewMat(nRow, nCol, false)
CompareMatrixElemFunc( size_t nRow, size_t nCol ) : mnRow(nRow), mnCol(nCol)
{
maNewMatValues.reserve(nRow*nCol);
}
@ -178,8 +178,8 @@ public:
void swap( MatrixImplType& rMat )
{
maNewMat.set(0, 0, maNewMatValues.begin(), maNewMatValues.end());
rMat.swap(maNewMat);
MatrixImplType aNewMat(mnRow, mnCol, maNewMatValues.begin(), maNewMatValues.end());
rMat.swap(aNewMat);
}
};