improve compilation error message for array+=matrix and the likes

This commit is contained in:
Gael Guennebaud 2010-08-16 11:07:17 +02:00
parent 453d54325e
commit c625a6a85b
2 changed files with 10 additions and 0 deletions

View File

@ -167,6 +167,11 @@ template<typename Derived> class ArrayBase
explicit ArrayBase(Index);
ArrayBase(Index,Index);
template<typename OtherDerived> explicit ArrayBase(const ArrayBase<OtherDerived>&);
protected:
// mixing arrays and matrices is not legal
template<typename OtherDerived> Derived& operator+=(const MatrixBase<OtherDerived>& mat);
// mixing arrays and matrices is not legal
template<typename OtherDerived> Derived& operator-=(const MatrixBase<OtherDerived>& mat);
};
/** replaces \c *this by \c *this - \a other.

View File

@ -427,6 +427,11 @@ template<typename Derived> class MatrixBase
explicit MatrixBase(int);
MatrixBase(int,int);
template<typename OtherDerived> explicit MatrixBase(const MatrixBase<OtherDerived>&);
protected:
// mixing arrays and matrices is not legal
template<typename OtherDerived> Derived& operator+=(const ArrayBase<OtherDerived>& array);
// mixing arrays and matrices is not legal
template<typename OtherDerived> Derived& operator-=(const ArrayBase<OtherDerived>& array);
};
#endif // EIGEN_MATRIXBASE_H