diff --git a/Eigen/src/Core/Flagged.h b/Eigen/src/Core/Flagged.h index 2e2a50be5..8fa904271 100644 --- a/Eigen/src/Core/Flagged.h +++ b/Eigen/src/Core/Flagged.h @@ -44,8 +44,7 @@ template clas typedef MatrixBase Base; EIGEN_DENSE_PUBLIC_INTERFACE(Flagged) - typedef typename internal::conditional::ret, - ExpressionType, const ExpressionType&>::type ExpressionTypeNested; + typedef typename internal::ref_selector::type ExpressionTypeNested; typedef typename ExpressionType::InnerIterator InnerIterator; explicit inline Flagged(const ExpressionType& matrix) : m_matrix(matrix) {} diff --git a/Eigen/src/Core/VectorwiseOp.h b/Eigen/src/Core/VectorwiseOp.h index a0f10b17b..d9456067f 100644 --- a/Eigen/src/Core/VectorwiseOp.h +++ b/Eigen/src/Core/VectorwiseOp.h @@ -160,8 +160,7 @@ template class VectorwiseOp typedef typename ExpressionType::Scalar Scalar; typedef typename ExpressionType::RealScalar RealScalar; typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3 - typedef typename internal::conditional::ret, - ExpressionType, ExpressionType&>::type ExpressionTypeNested; + typedef typename internal::ref_selector::non_const_type ExpressionTypeNested; typedef typename internal::remove_all::type ExpressionTypeNestedCleaned; template class Functor, diff --git a/Eigen/src/Core/util/XprHelper.h b/Eigen/src/Core/util/XprHelper.h index 8e12ce5a0..2cd78576e 100644 --- a/Eigen/src/Core/util/XprHelper.h +++ b/Eigen/src/Core/util/XprHelper.h @@ -312,9 +312,6 @@ template struct plain_matrix_type_row_major > type; }; -// TODO we should be able to get rid of this one too -template struct must_nest_by_value { enum { ret = false }; }; - /** \internal The reference selector for template expressions. The idea is that we don't * need to use references for expressions since they are light weight proxy * objects which should generate no copying overhead. */ @@ -326,6 +323,12 @@ struct ref_selector T const&, const T >::type type; + + typedef typename conditional< + bool(traits::Flags & NestByRefBit), + T &, + T + >::type non_const_type; }; /** \internal Adds the const qualifier on the value-type of T2 if and only if T1 is a const type */