further improve compilation error message for array+=matrix

This commit is contained in:
Gael Guennebaud
2010-08-16 11:13:02 +02:00
parent c625a6a85b
commit b37551f62a
3 changed files with 10 additions and 5 deletions

View File

@@ -169,9 +169,11 @@ template<typename Derived> class ArrayBase
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);
template<typename OtherDerived> Derived& operator+=(const MatrixBase<OtherDerived>& mat)
{EIGEN_STATIC_ASSERT(sizeof(typename OtherDerived::Scalar)==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES);}
// mixing arrays and matrices is not legal
template<typename OtherDerived> Derived& operator-=(const MatrixBase<OtherDerived>& mat);
template<typename OtherDerived> Derived& operator-=(const MatrixBase<OtherDerived>& mat)
{EIGEN_STATIC_ASSERT(sizeof(typename OtherDerived::Scalar)==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES);}
};
/** replaces \c *this by \c *this - \a other.