10 #ifndef EIGEN_NOALIAS_H
11 #define EIGEN_NOALIAS_H
30 template<
typename ExpressionType,
template <
typename>
class StorageBase>
33 typedef typename ExpressionType::Scalar Scalar;
35 NoAlias(ExpressionType& expression) : m_expression(expression) {}
39 template<
typename OtherDerived>
40 EIGEN_STRONG_INLINE ExpressionType&
operator=(
const StorageBase<OtherDerived>& other)
41 {
return internal::assign_selector<ExpressionType,OtherDerived,false>::run(m_expression,other.derived()); }
44 template<
typename OtherDerived>
45 EIGEN_STRONG_INLINE ExpressionType&
operator+=(
const StorageBase<OtherDerived>& other)
47 typedef SelfCwiseBinaryOp<internal::scalar_sum_op<Scalar>, ExpressionType, OtherDerived> SelfAdder;
48 SelfAdder tmp(m_expression);
49 typedef typename internal::nested<OtherDerived>::type OtherDerivedNested;
50 typedef typename internal::remove_all<OtherDerivedNested>::type _OtherDerivedNested;
51 internal::assign_selector<SelfAdder,_OtherDerivedNested,false>::run(tmp,OtherDerivedNested(other.derived()));
56 template<
typename OtherDerived>
57 EIGEN_STRONG_INLINE ExpressionType&
operator-=(
const StorageBase<OtherDerived>& other)
59 typedef SelfCwiseBinaryOp<internal::scalar_difference_op<Scalar>, ExpressionType, OtherDerived> SelfAdder;
60 SelfAdder tmp(m_expression);
61 typedef typename internal::nested<OtherDerived>::type OtherDerivedNested;
62 typedef typename internal::remove_all<OtherDerivedNested>::type _OtherDerivedNested;
63 internal::assign_selector<SelfAdder,_OtherDerivedNested,false>::run(tmp,OtherDerivedNested(other.derived()));
67 #ifndef EIGEN_PARSED_BY_DOXYGEN
68 template<
typename ProductDerived,
typename Lhs,
typename Rhs>
69 EIGEN_STRONG_INLINE ExpressionType&
operator+=(
const ProductBase<ProductDerived, Lhs,Rhs>& other)
70 { other.derived().addTo(m_expression);
return m_expression; }
72 template<
typename ProductDerived,
typename Lhs,
typename Rhs>
73 EIGEN_STRONG_INLINE ExpressionType&
operator-=(
const ProductBase<ProductDerived, Lhs,Rhs>& other)
74 { other.derived().subTo(m_expression);
return m_expression; }
76 template<
typename Lhs,
typename Rhs,
int NestingFlags>
77 EIGEN_STRONG_INLINE ExpressionType&
operator+=(
const CoeffBasedProduct<Lhs,Rhs,NestingFlags>& other)
78 {
return m_expression.derived() += CoeffBasedProduct<Lhs,Rhs,NestByRefBit>(other.lhs(), other.rhs()); }
80 template<
typename Lhs,
typename Rhs,
int NestingFlags>
81 EIGEN_STRONG_INLINE ExpressionType&
operator-=(
const CoeffBasedProduct<Lhs,Rhs,NestingFlags>& other)
82 {
return m_expression.derived() -= CoeffBasedProduct<Lhs,Rhs,NestByRefBit>(other.lhs(), other.rhs()); }
84 template<
typename OtherDerived>
85 ExpressionType&
operator=(
const ReturnByValue<OtherDerived>& func)
86 {
return m_expression = func; }
89 ExpressionType& expression()
const
95 ExpressionType& m_expression;
126 template<
typename Derived>
134 #endif // EIGEN_NOALIAS_H
Pseudo expression providing an operator = assuming no aliasing.
Definition: NoAlias.h:31
ExpressionType & operator=(const StorageBase< OtherDerived > &other)
Definition: NoAlias.h:40
NoAlias< Derived, Eigen::MatrixBase > noalias()
Definition: NoAlias.h:127
ExpressionType & operator+=(const StorageBase< OtherDerived > &other)
Definition: NoAlias.h:45
ExpressionType & operator-=(const StorageBase< OtherDerived > &other)
Definition: NoAlias.h:57