From 9bb75937cc698b32f2fe6ffac3b4e09a89c3c5f7 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 6 Sep 2010 11:51:42 +0200 Subject: fix += return by value like operations --- Eigen/src/Core/SelfCwiseBinaryOp.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'Eigen/src/Core/SelfCwiseBinaryOp.h') diff --git a/Eigen/src/Core/SelfCwiseBinaryOp.h b/Eigen/src/Core/SelfCwiseBinaryOp.h index 5100f6b25..f77589747 100644 --- a/Eigen/src/Core/SelfCwiseBinaryOp.h +++ b/Eigen/src/Core/SelfCwiseBinaryOp.h @@ -62,8 +62,6 @@ template class SelfCwiseBinaryOp typedef typename ei_packet_traits::type Packet; - using Base::operator=; - inline SelfCwiseBinaryOp(Lhs& xpr, const BinaryOp& func = BinaryOp()) : m_matrix(xpr), m_functor(func) {} inline Index rows() const { return m_matrix.rows(); } @@ -142,6 +140,15 @@ template class SelfCwiseBinaryOp #endif return *this; } + + // overloaded to honor evaluation of special matrices + // maybe another solution would be to not use SelfCwiseBinaryOp + // at first... + SelfCwiseBinaryOp& operator=(const Rhs& _rhs) + { + typename ei_nested::type rhs(_rhs); + return Base::operator=(rhs); + } protected: Lhs& m_matrix; -- cgit v1.2.3