mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-10 02:39:03 +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;
|
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:
|
protected:
|
||||||
MatrixRef<MatrixBase<Derived> > m_ref;
|
MatrixRef<MatrixBase<Derived> > m_ref;
|
||||||
Derived m_tmp;
|
Derived m_tmp;
|
||||||
|
@ -48,6 +48,7 @@ template<typename VectorType> void vectorOps(const VectorType& v)
|
|||||||
a += b + b;
|
a += b + b;
|
||||||
a.xpr() -= b;
|
a.xpr() -= b;
|
||||||
a.xpr() -= b + b;
|
a.xpr() -= b + b;
|
||||||
|
a.alias() += a + a;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EigenTest::testVectorOps()
|
void EigenTest::testVectorOps()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user