fix bugs caused by default copy constructors being called. valgrind,

you saved my life.
This commit is contained in:
Benoit Jacob
2007-09-26 14:06:32 +00:00
parent a2dd9dd6f9
commit 8a024825d2
4 changed files with 18 additions and 20 deletions

View File

@@ -73,29 +73,30 @@ class Matrix : public EigenBase<_Scalar, Matrix<_Scalar, _Rows, _Cols> >,
public:
template<typename OtherDerived>
Matrix& operator=(const EigenBase<Scalar, OtherDerived> &other)
Matrix& operator=(const EigenBase<Scalar, OtherDerived>& other)
{
resize(other.rows(), other.cols());
return Base::operator=(other);
}
Matrix& operator=(const Matrix& other)
{
resize(other.rows(), other.cols());
return Base::operator=(other);
}
template<typename OtherDerived>
Matrix& operator+=(const EigenBase<Scalar, OtherDerived> &other)
{
return Base::operator+=(other);
}
template<typename OtherDerived>
Matrix& operator-=(const EigenBase<Scalar, OtherDerived> &other)
{
return Base::operator-=(other);
}
INHERIT_ASSIGNMENT_OPERATOR(Matrix, +=)
INHERIT_ASSIGNMENT_OPERATOR(Matrix, -=)
explicit Matrix(int rows = 1, int cols = 1) : Storage(rows, cols) {}
template<typename OtherDerived>
Matrix(const EigenBase<Scalar, OtherDerived>& other) : Storage(other.rows(), other.cols())
{
*this = other;
}
Matrix(const Matrix& other) : Storage(other.rows(), other.cols())
{
*this = other;
}
~Matrix() {}
};