diff options
author | Gael Guennebaud <g.gael@free.fr> | 2014-06-20 15:39:38 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2014-06-20 15:39:38 +0200 |
commit | 78bb80833708615c330659d9b64870b19185df37 (patch) | |
tree | 15976a9b6efcf2e9a63b8ed9136737a2006fc527 /Eigen/src/Core/ReturnByValue.h | |
parent | 0a6c472335b593a227c3adbcf1d770187449a30f (diff) |
1- Introduce sub-evaluator types for unary, binary, product, and map expressions to ease specializing them.
2- Remove a lot of code which should not be there with evaluators, in particular coeff/packet methods implemented in the expressions.
Diffstat (limited to 'Eigen/src/Core/ReturnByValue.h')
-rw-r--r-- | Eigen/src/Core/ReturnByValue.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Eigen/src/Core/ReturnByValue.h b/Eigen/src/Core/ReturnByValue.h index d63b96138..30ade1b75 100644 --- a/Eigen/src/Core/ReturnByValue.h +++ b/Eigen/src/Core/ReturnByValue.h @@ -92,6 +92,34 @@ Derived& DenseBase<Derived>::operator=(const ReturnByValue<OtherDerived>& other) return derived(); } +#ifdef EIGEN_TEST_EVALUATORS +namespace internal { + +template<typename Derived> +struct evaluator<ReturnByValue<Derived> > + : public evaluator<typename internal::traits<Derived>::ReturnType>::type +{ + typedef ReturnByValue<Derived> XprType; + typedef typename internal::traits<Derived>::ReturnType PlainObject; + typedef typename evaluator<PlainObject>::type Base; + + typedef evaluator type; + typedef evaluator nestedType; + + evaluator(const XprType& xpr) + : m_result(xpr.rows(), xpr.cols()) + { + ::new (static_cast<Base*>(this)) Base(m_result); + xpr.evalTo(m_result); + } + +protected: + PlainObject m_result; +}; + +} // end namespace internal +#endif + } // end namespace Eigen #endif // EIGEN_RETURNBYVALUE_H |