mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-15 07:10:37 +08:00
extend operators += and -= to aliases
This commit is contained in:
parent
c3731b36d1
commit
c030e570fd
@ -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;
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user