From 641d968a9a7ed57a3b8a3f45dea43c5ee6717f97 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Sun, 30 May 2010 13:43:08 -0400 Subject: * Make ReturnByValue have the EvalBeforeAssigningBit and explicitly enforce this mechanism (otherwise ReturnByValue bypasses it). (use .noalias() to get the old behavior.) * Remove a hack in Inverse, futile optimization for 2x2 expressions. --- Eigen/src/Core/ReturnByValue.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'Eigen/src/Core/ReturnByValue.h') diff --git a/Eigen/src/Core/ReturnByValue.h b/Eigen/src/Core/ReturnByValue.h index 986bab54d..b2e581c70 100644 --- a/Eigen/src/Core/ReturnByValue.h +++ b/Eigen/src/Core/ReturnByValue.h @@ -36,9 +36,9 @@ struct ei_traits > enum { // We're disabling the DirectAccess because e.g. the constructor of // the Block-with-DirectAccess expression requires to have a coeffRef method. - // Also, we don't want to have to implement the stride stuff. + // FIXME this should be fixed so we can have DirectAccessBit here. Flags = (ei_traits::ReturnType>::Flags - | EvalBeforeNestingBit) & ~DirectAccessBit + | EvalBeforeNestingBit | EvalBeforeAssigningBit) & ~DirectAccessBit }; }; @@ -83,8 +83,11 @@ template template Derived& DenseBase::operator=(const ReturnByValue& other) { - other.evalTo(derived()); - return derived(); + // since we're by-passing the mechanisms in Assign.h, we implement here the EvalBeforeAssigningBit. + // override by using .noalias(), see corresponding operator= in NoAlias. + typename Derived::PlainObject result(rows(), cols()); + other.evalTo(result); + return (derived() = result); } #endif // EIGEN_RETURNBYVALUE_H -- cgit v1.2.3