extend operators += and -= to aliases

This commit is contained in:
Benoit Jacob 2007-09-07 07:56:22 +00:00
parent c3731b36d1
commit c030e570fd
2 changed files with 13 additions and 0 deletions

View File

@ -308,6 +308,18 @@ template<typename Derived> class MatrixAlias
ref().xpr() = xpr;
}
template<typename XprContent>
void operator+=(const MatrixConstXpr<XprContent> &xpr)
{
ref().xpr() += xpr;
}
template<typename XprContent>
void operator-=(const MatrixConstXpr<XprContent> &xpr)
{
ref().xpr() -= xpr;
}
protected:
MatrixRef<MatrixBase<Derived> > m_ref;
Derived m_tmp;

View File

@ -48,6 +48,7 @@ template<typename VectorType> void vectorOps(const VectorType& v)
a += b + b;
a.xpr() -= b;
a.xpr() -= b + b;
a.alias() += a + a;
}
void EigenTest::testVectorOps()