casting to the same type no longer generates a CwiseUnaryOp

This commit is contained in:
Gael Guennebaud 2009-04-29 14:57:18 +00:00
parent 8b1e7c2792
commit 9e9e99a42e
2 changed files with 11 additions and 3 deletions

View File

@ -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();

View File

@ -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