diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2010-06-01 09:17:50 -0400 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2010-06-01 09:17:50 -0400 |
commit | e54faba198a67a6177ca3743a3b884a77aa92512 (patch) | |
tree | b7902687bbbbfec13b14383b0dd363bc4c38748a /Eigen/src/Core/ReturnByValue.h | |
parent | 09a1b7f7e1ec09f96dd0f58bb6bc22881e0c76b6 (diff) | |
parent | 3e95609cd4f036ccb647f9a590062cdb250e9760 (diff) |
merge the backing-out of the stupid RetByVal change, and implement a simple
aliasing check in inverse, that catches simple cases like x = x.inverse()
Diffstat (limited to 'Eigen/src/Core/ReturnByValue.h')
-rw-r--r-- | Eigen/src/Core/ReturnByValue.h | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/Eigen/src/Core/ReturnByValue.h b/Eigen/src/Core/ReturnByValue.h index 665d48031..90887356c 100644 --- a/Eigen/src/Core/ReturnByValue.h +++ b/Eigen/src/Core/ReturnByValue.h @@ -36,9 +36,9 @@ struct ei_traits<ReturnByValue<Derived> > enum { // We're disabling the DirectAccess because e.g. the constructor of // the Block-with-DirectAccess expression requires to have a coeffRef method. - // FIXME this should be fixed so we can have DirectAccessBit here. + // Also, we don't want to have to implement the stride stuff. Flags = (ei_traits<typename ei_traits<Derived>::ReturnType>::Flags - | EvalBeforeNestingBit | EvalBeforeAssigningBit) & ~DirectAccessBit + | EvalBeforeNestingBit) & ~DirectAccessBit }; }; @@ -84,11 +84,8 @@ template<typename Derived> template<typename OtherDerived> Derived& DenseBase<Derived>::operator=(const ReturnByValue<OtherDerived>& other) { - // 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); + other.evalTo(derived()); + return derived(); } #endif // EIGEN_RETURNBYVALUE_H |