bug #96, bug #1006: fix by value argument in result_of.

This commit is contained in:
Gael Guennebaud 2016-01-28 12:12:06 +01:00
parent 7802a6bb1c
commit 2bad3e78d9
5 changed files with 7 additions and 7 deletions

View File

@ -32,8 +32,8 @@ struct traits<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
// we still want to handle the case when the result type is different. // we still want to handle the case when the result type is different.
typedef typename result_of< typedef typename result_of<
BinaryOp( BinaryOp(
typename Lhs::Scalar, const typename Lhs::Scalar&,
typename Rhs::Scalar const typename Rhs::Scalar&
) )
>::type Scalar; >::type Scalar;
typedef typename cwise_promote_storage_type<typename traits<Lhs>::StorageKind, typedef typename cwise_promote_storage_type<typename traits<Lhs>::StorageKind,

View File

@ -19,7 +19,7 @@ struct traits<CwiseUnaryOp<UnaryOp, XprType> >
: traits<XprType> : traits<XprType>
{ {
typedef typename result_of< typedef typename result_of<
UnaryOp(typename XprType::Scalar) UnaryOp(const typename XprType::Scalar&)
>::type Scalar; >::type Scalar;
typedef typename XprType::Nested XprTypeNested; typedef typename XprType::Nested XprTypeNested;
typedef typename remove_reference<XprTypeNested>::type _XprTypeNested; typedef typename remove_reference<XprTypeNested>::type _XprTypeNested;

View File

@ -18,7 +18,7 @@ struct traits<CwiseUnaryView<ViewOp, MatrixType> >
: traits<MatrixType> : traits<MatrixType>
{ {
typedef typename result_of< typedef typename result_of<
ViewOp(typename traits<MatrixType>::Scalar) ViewOp(const typename traits<MatrixType>::Scalar&)
>::type Scalar; >::type Scalar;
typedef typename MatrixType::Nested MatrixTypeNested; typedef typename MatrixType::Nested MatrixTypeNested;
typedef typename remove_all<MatrixTypeNested>::type _MatrixTypeNested; typedef typename remove_all<MatrixTypeNested>::type _MatrixTypeNested;

View File

@ -124,7 +124,7 @@ struct member_lpnorm {
template <typename BinaryOp, typename Scalar> template <typename BinaryOp, typename Scalar>
struct member_redux { struct member_redux {
typedef typename result_of< typedef typename result_of<
BinaryOp(Scalar,Scalar) BinaryOp(const Scalar&,const Scalar&)
>::type result_type; >::type result_type;
template<typename _Scalar, int Size> struct Cost template<typename _Scalar, int Size> struct Cost
{ enum { value = (Size-1) * functor_traits<BinaryOp>::Cost }; }; { enum { value = (Size-1) * functor_traits<BinaryOp>::Cost }; };

View File

@ -257,7 +257,7 @@ struct has_std_result_type {int a[2];};
struct has_tr1_result {int a[3];}; struct has_tr1_result {int a[3];};
template<typename Func, typename ArgType, int SizeOf=sizeof(has_none)> template<typename Func, typename ArgType, int SizeOf=sizeof(has_none)>
struct unary_result_of_select {typedef ArgType type;}; struct unary_result_of_select {typedef typename internal::remove_all<ArgType>::type type;};
template<typename Func, typename ArgType> template<typename Func, typename ArgType>
struct unary_result_of_select<Func, ArgType, sizeof(has_std_result_type)> {typedef typename Func::result_type type;}; struct unary_result_of_select<Func, ArgType, sizeof(has_std_result_type)> {typedef typename Func::result_type type;};
@ -279,7 +279,7 @@ struct result_of<Func(ArgType)> {
}; };
template<typename Func, typename ArgType0, typename ArgType1, int SizeOf=sizeof(has_none)> template<typename Func, typename ArgType0, typename ArgType1, int SizeOf=sizeof(has_none)>
struct binary_result_of_select {typedef ArgType0 type;}; struct binary_result_of_select {typedef typename internal::remove_all<ArgType0>::type type;};
template<typename Func, typename ArgType0, typename ArgType1> template<typename Func, typename ArgType0, typename ArgType1>
struct binary_result_of_select<Func, ArgType0, ArgType1, sizeof(has_std_result_type)> struct binary_result_of_select<Func, ArgType0, ArgType1, sizeof(has_std_result_type)>