diff options
Diffstat (limited to 'Eigen/src/Core/util/Meta.h')
-rwxr-xr-x | Eigen/src/Core/util/Meta.h | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/Eigen/src/Core/util/Meta.h b/Eigen/src/Core/util/Meta.h index e69c78db2..96563962e 100755 --- a/Eigen/src/Core/util/Meta.h +++ b/Eigen/src/Core/util/Meta.h @@ -368,29 +368,26 @@ struct result_of<Func(ArgType0,ArgType1,ArgType2)> { }; #endif +struct meta_yes { char a[1]; }; +struct meta_no { char a[2]; }; + // Check whether T::ReturnType does exist template <typename T> struct has_ReturnType { - typedef char yes[1]; - typedef char no[2]; - - template <typename C> static yes& testFunctor(typename C::ReturnType const *); - template <typename C> static no& testFunctor(...); + template <typename C> static meta_yes testFunctor(typename C::ReturnType const *); + template <typename C> static meta_no testFunctor(...); - enum { value = sizeof(testFunctor<T>(0)) == sizeof(yes) }; + enum { value = sizeof(testFunctor<T>(0)) == sizeof(meta_yes) }; }; -template<int> struct any_int {}; +template<int Val> struct integral_constant { static const int value = Val; }; template<typename T> const T& return_ref(); -struct meta_yes { char data[1]; }; -struct meta_no { char data[2]; }; - template <typename T> struct has_nullary_operator { - template <typename C> static meta_yes testFunctor(C const *,any_int< sizeof(return_ref<C>()()) > * = 0); + template <typename C> static meta_yes testFunctor(C const *,integral_constant< sizeof(return_ref<C>()()) > * = 0); static meta_no testFunctor(...); enum { value = sizeof(testFunctor(static_cast<T*>(0))) == sizeof(meta_yes) }; @@ -399,7 +396,7 @@ struct has_nullary_operator template <typename T> struct has_unary_operator { - template <typename C> static meta_yes testFunctor(C const *,any_int< sizeof(return_ref<C>()(Index(0))) > * = 0); + template <typename C> static meta_yes testFunctor(C const *,integral_constant< sizeof(return_ref<C>()(Index(0))) > * = 0); static meta_no testFunctor(...); enum { value = sizeof(testFunctor(static_cast<T*>(0))) == sizeof(meta_yes) }; @@ -408,7 +405,7 @@ struct has_unary_operator template <typename T> struct has_binary_operator { - template <typename C> static meta_yes testFunctor(C const *,any_int< sizeof(return_ref<C>()(Index(0),Index(0))) > * = 0); + template <typename C> static meta_yes testFunctor(C const *,integral_constant< sizeof(return_ref<C>()(Index(0),Index(0))) > * = 0); static meta_no testFunctor(...); enum { value = sizeof(testFunctor(static_cast<T*>(0))) == sizeof(meta_yes) }; |