diff options
author | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2015-02-19 21:23:37 -0800 |
---|---|---|
committer | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2015-02-19 21:23:37 -0800 |
commit | ab41652d813b5d83715a92183da4bbfce5779473 (patch) | |
tree | 8a4f8ae4f43f077516a060f313cfaa04709818d0 /Eigen/src/Core | |
parent | 7765039f1cc7b9c78b26b9d7c807df2eddcf829f (diff) | |
parent | a66f5fc2fd5ae26eeecb327e4bde9aeaa0edfced (diff) |
Pulled latest changes from trunk
Diffstat (limited to 'Eigen/src/Core')
-rw-r--r-- | Eigen/src/Core/DenseBase.h | 2 | ||||
-rw-r--r-- | Eigen/src/Core/GeneralProduct.h | 4 | ||||
-rw-r--r-- | Eigen/src/Core/Redux.h | 2 | ||||
-rw-r--r-- | Eigen/src/Core/VectorwiseOp.h | 2 | ||||
-rw-r--r-- | Eigen/src/Core/util/Meta.h | 29 |
5 files changed, 13 insertions, 26 deletions
diff --git a/Eigen/src/Core/DenseBase.h b/Eigen/src/Core/DenseBase.h index 322daad8f..c30d1bed9 100644 --- a/Eigen/src/Core/DenseBase.h +++ b/Eigen/src/Core/DenseBase.h @@ -429,7 +429,7 @@ template<typename Derived> class DenseBase template<typename BinaryOp> EIGEN_DEVICE_FUNC - typename internal::result_of<BinaryOp(typename internal::traits<Derived>::Scalar)>::type + typename internal::result_of<BinaryOp(typename internal::traits<Derived>::Scalar,typename internal::traits<Derived>::Scalar)>::type redux(const BinaryOp& func) const; template<typename Visitor> diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index 7027130e0..0ecfab449 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -249,8 +249,8 @@ template<> struct gemv_dense_sense_selector<OnTheRight,ColMajor,true> gemv_static_vector_if<ResScalar,Dest::SizeAtCompileTime,Dest::MaxSizeAtCompileTime,MightCannotUseDest> static_dest; - bool alphaIsCompatible = (!ComplexByReal) || (numext::imag(actualAlpha)==RealScalar(0)); - bool evalToDest = EvalToDestAtCompileTime && alphaIsCompatible; + const bool alphaIsCompatible = (!ComplexByReal) || (numext::imag(actualAlpha)==RealScalar(0)); + const bool evalToDest = EvalToDestAtCompileTime && alphaIsCompatible; RhsScalar compatibleAlpha = get_factor<ResScalar,RhsScalar>::run(actualAlpha); diff --git a/Eigen/src/Core/Redux.h b/Eigen/src/Core/Redux.h index 1a0a00481..f704fd07b 100644 --- a/Eigen/src/Core/Redux.h +++ b/Eigen/src/Core/Redux.h @@ -406,7 +406,7 @@ protected: */ template<typename Derived> template<typename Func> -EIGEN_STRONG_INLINE typename internal::result_of<Func(typename internal::traits<Derived>::Scalar)>::type +EIGEN_STRONG_INLINE typename internal::result_of<Func(typename internal::traits<Derived>::Scalar,typename internal::traits<Derived>::Scalar)>::type DenseBase<Derived>::redux(const Func& func) const { eigen_assert(this->rows()>0 && this->cols()>0 && "you are using an empty matrix"); diff --git a/Eigen/src/Core/VectorwiseOp.h b/Eigen/src/Core/VectorwiseOp.h index b3dc0c224..a15777a5e 100644 --- a/Eigen/src/Core/VectorwiseOp.h +++ b/Eigen/src/Core/VectorwiseOp.h @@ -124,7 +124,7 @@ EIGEN_MEMBER_FUNCTOR(prod, (Size-1)*NumTraits<Scalar>::MulCost); template <typename BinaryOp, typename Scalar> struct member_redux { typedef typename result_of< - BinaryOp(Scalar) + BinaryOp(Scalar,Scalar) >::type result_type; template<typename _Scalar, int Size> struct Cost { enum { value = (Size-1) * functor_traits<BinaryOp>::Cost }; }; diff --git a/Eigen/src/Core/util/Meta.h b/Eigen/src/Core/util/Meta.h index 674cd8f97..974f11516 100644 --- a/Eigen/src/Core/util/Meta.h +++ b/Eigen/src/Core/util/Meta.h @@ -160,12 +160,17 @@ protected: * upcoming next STL generation (using a templated result member). * If none of these members is provided, then the type of the first argument is returned. FIXME, that behavior is a pretty bad hack. */ -template<typename T> struct result_of {}; +#ifdef EIGEN_HAS_STD_RESULT_OF +template<typename T> struct result_of { + typedef typename std::result_of<T>::type type1; + typedef typename remove_all<type1>::type type; +}; +#else +template<typename T> struct result_of { }; struct has_none {int a[1];}; struct has_std_result_type {int a[2];}; struct has_tr1_result {int a[3];}; -struct has_cxx_eleven_result {int a[4];}; template<typename Func, typename ArgType, int SizeOf=sizeof(has_none)> struct unary_result_of_select {typedef ArgType type;}; @@ -176,21 +181,12 @@ struct unary_result_of_select<Func, ArgType, sizeof(has_std_result_type)> {typed template<typename Func, typename ArgType> struct unary_result_of_select<Func, ArgType, sizeof(has_tr1_result)> {typedef typename Func::template result<Func(ArgType)>::type type;}; -#ifdef EIGEN_HAS_STD_RESULT_OF -template<typename Func, typename ArgType> -struct unary_result_of_select<Func, ArgType, sizeof(has_cxx_eleven_result)> {typedef typename std::result_of<Func(ArgType)>::type type;}; -#endif - template<typename Func, typename ArgType> struct result_of<Func(ArgType)> { template<typename T> static has_std_result_type testFunctor(T const *, typename T::result_type const * = 0); template<typename T> static has_tr1_result testFunctor(T const *, typename T::template result<T(ArgType)>::type const * = 0); -#ifdef EIGEN_HAS_STD_RESULT_OF - template<typename T> - static has_cxx_eleven_result testFunctor(T const *, typename std::result_of<T(ArgType)>::type const * = 0); -#endif static has_none testFunctor(...); // note that the following indirection is needed for gcc-3.3 @@ -209,28 +205,19 @@ template<typename Func, typename ArgType0, typename ArgType1> struct binary_result_of_select<Func, ArgType0, ArgType1, sizeof(has_tr1_result)> {typedef typename Func::template result<Func(ArgType0,ArgType1)>::type type;}; -#ifdef EIGEN_HAS_STD_RESULT_OF -template<typename Func, typename ArgType0, typename ArgType1> -struct binary_result_of_select<Func, ArgType0, ArgType1, sizeof(has_cxx_eleven_result)> -{typedef typename std::result_of<Func(ArgType0, ArgType1)>::type type;}; -#endif - template<typename Func, typename ArgType0, typename ArgType1> struct result_of<Func(ArgType0,ArgType1)> { template<typename T> static has_std_result_type testFunctor(T const *, typename T::result_type const * = 0); template<typename T> static has_tr1_result testFunctor(T const *, typename T::template result<T(ArgType0,ArgType1)>::type const * = 0); -#ifdef EIGEN_HAS_STD_RESULT_OF - template<typename T> - static has_cxx_eleven_result testFunctor(T const *, typename std::result_of<T(ArgType0, ArgType1)>::type const * = 0); -#endif static has_none testFunctor(...); // note that the following indirection is needed for gcc-3.3 enum {FunctorType = sizeof(testFunctor(static_cast<Func*>(0)))}; typedef typename binary_result_of_select<Func, ArgType0, ArgType1, FunctorType>::type type; }; +#endif /** \internal In short, it computes int(sqrt(\a Y)) with \a Y an integer. * Usage example: \code meta_sqrt<1023>::ret \endcode |