From 836fa25a822d036230d23b4ed0df9eb22684fdc6 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Wed, 31 Aug 2016 23:40:18 +0200 Subject: [PATCH] Make sure sizeof is truelly needed, thus improving SFINAE portability. --- Eigen/src/Core/util/Meta.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Eigen/src/Core/util/Meta.h b/Eigen/src/Core/util/Meta.h index 96563962e..29c149c34 100755 --- a/Eigen/src/Core/util/Meta.h +++ b/Eigen/src/Core/util/Meta.h @@ -381,13 +381,13 @@ struct has_ReturnType enum { value = sizeof(testFunctor(0)) == sizeof(meta_yes) }; }; -template struct integral_constant { static const int value = Val; }; +template struct meta_array { int a[Size]; }; template const T& return_ref(); template struct has_nullary_operator { - template static meta_yes testFunctor(C const *,integral_constant< sizeof(return_ref()()) > * = 0); + template static meta_yes testFunctor(C const *,meta_array< sizeof(return_ref()()) > * = 0); static meta_no testFunctor(...); enum { value = sizeof(testFunctor(static_cast(0))) == sizeof(meta_yes) }; @@ -396,7 +396,7 @@ struct has_nullary_operator template struct has_unary_operator { - template static meta_yes testFunctor(C const *,integral_constant< sizeof(return_ref()(Index(0))) > * = 0); + template static meta_yes testFunctor(C const *,meta_array< sizeof(return_ref()(Index(0))) > * = 0); static meta_no testFunctor(...); enum { value = sizeof(testFunctor(static_cast(0))) == sizeof(meta_yes) }; @@ -405,7 +405,7 @@ struct has_unary_operator template struct has_binary_operator { - template static meta_yes testFunctor(C const *,integral_constant< sizeof(return_ref()(Index(0),Index(0))) > * = 0); + template static meta_yes testFunctor(C const *,meta_array< sizeof(return_ref()(Index(0),Index(0))) > * = 0); static meta_no testFunctor(...); enum { value = sizeof(testFunctor(static_cast(0))) == sizeof(meta_yes) };