aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2009-04-29 14:57:18 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2009-04-29 14:57:18 +0000
commit9e9e99a42e136d4fde22f408438c6afa06e49a85 (patch)
treeacda186e94e06a40e5c76e34e7f1a466b3e6aafc
parent8b1e7c2792525ecc43f68ee42bf6af1473fd6699 (diff)
casting to the same type no longer generates a CwiseUnaryOp
-rw-r--r--Eigen/src/Core/CwiseUnaryOp.h6
-rw-r--r--Eigen/src/Core/MatrixBase.h8
2 files changed, 11 insertions, 3 deletions
diff --git a/Eigen/src/Core/CwiseUnaryOp.h b/Eigen/src/Core/CwiseUnaryOp.h
index 076d568e0..5915dad54 100644
--- a/Eigen/src/Core/CwiseUnaryOp.h
+++ b/Eigen/src/Core/CwiseUnaryOp.h
@@ -188,7 +188,11 @@ MatrixBase<Derived>::imag() const { return derived(); }
*/
template<typename Derived>
template<typename NewType>
-EIGEN_STRONG_INLINE const CwiseUnaryOp<ei_scalar_cast_op<typename ei_traits<Derived>::Scalar, NewType>, Derived>
+EIGEN_STRONG_INLINE
+typename ei_cast_return_type<
+ const Derived&,
+ const CwiseUnaryOp<ei_scalar_cast_op<typename ei_traits<Derived>::Scalar, NewType>, Derived>
+ >::type
MatrixBase<Derived>::cast() const
{
return derived();
diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h
index a4e4e15d7..7eb7c1eff 100644
--- a/Eigen/src/Core/MatrixBase.h
+++ b/Eigen/src/Core/MatrixBase.h
@@ -504,8 +504,12 @@ template<typename Derived> class MatrixBase
template<typename NewType>
- const CwiseUnaryOp<ei_scalar_cast_op<typename ei_traits<Derived>::Scalar, NewType>, Derived> cast() const;
-
+ typename ei_cast_return_type<
+ const Derived&,
+ const CwiseUnaryOp<ei_scalar_cast_op<typename ei_traits<Derived>::Scalar, NewType>, Derived>
+ >::type
+ cast() const;
+
/** \returns the matrix or vector obtained by evaluating this expression.
*
* Notice that in the case of a plain matrix or vector (not an expression) this function just returns