From a66f5fc2fd5ae26eeecb327e4bde9aeaa0edfced Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Thu, 19 Feb 2015 23:32:12 +0100 Subject: Fix regression with C++11 support of lambda: now internal::result_of falls back to std::result_of in C++11. --- Eigen/src/Core/util/Meta.h | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) (limited to 'Eigen/src/Core/util') 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 struct result_of {}; +#ifdef EIGEN_HAS_STD_RESULT_OF +template struct result_of { + typedef typename std::result_of::type type1; + typedef typename remove_all::type type; +}; +#else +template 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 struct unary_result_of_select {typedef ArgType type;}; @@ -176,21 +181,12 @@ struct unary_result_of_select {typed template struct unary_result_of_select {typedef typename Func::template result::type type;}; -#ifdef EIGEN_HAS_STD_RESULT_OF -template -struct unary_result_of_select {typedef typename std::result_of::type type;}; -#endif - template struct result_of { template static has_std_result_type testFunctor(T const *, typename T::result_type const * = 0); template static has_tr1_result testFunctor(T const *, typename T::template result::type const * = 0); -#ifdef EIGEN_HAS_STD_RESULT_OF - template - static has_cxx_eleven_result testFunctor(T const *, typename std::result_of::type const * = 0); -#endif static has_none testFunctor(...); // note that the following indirection is needed for gcc-3.3 @@ -209,28 +205,19 @@ template struct binary_result_of_select {typedef typename Func::template result::type type;}; -#ifdef EIGEN_HAS_STD_RESULT_OF -template -struct binary_result_of_select -{typedef typename std::result_of::type type;}; -#endif - template struct result_of { template static has_std_result_type testFunctor(T const *, typename T::result_type const * = 0); template static has_tr1_result testFunctor(T const *, typename T::template result::type const * = 0); -#ifdef EIGEN_HAS_STD_RESULT_OF - template - static has_cxx_eleven_result testFunctor(T const *, typename std::result_of::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(0)))}; typedef typename binary_result_of_select::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 -- cgit v1.2.3