From 21cf4a1a8b0868b6dcb74aa4ebe6317d5316b2e1 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Thu, 12 Jul 2018 09:57:19 +0200 Subject: Make is_convertible more robust and conformant to std::is_convertible --- Eigen/src/Core/util/Meta.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'Eigen/src/Core/util') diff --git a/Eigen/src/Core/util/Meta.h b/Eigen/src/Core/util/Meta.h index ef9860c4b..3d2bdd12e 100755 --- a/Eigen/src/Core/util/Meta.h +++ b/Eigen/src/Core/util/Meta.h @@ -145,16 +145,19 @@ private: struct yes {int a[1];}; struct no {int a[2];}; - static yes test(const To&, int); + template + static yes test(T, int); + + template static no test(any_conversion, ...); public: - static From ms_from; + static From* ms_from; #ifdef __INTEL_COMPILER #pragma warning push #pragma warning ( disable : 2259 ) #endif - enum { value = sizeof(test(ms_from, 0))==sizeof(yes) }; + enum { value = sizeof(test(*ms_from, 0))==sizeof(yes) }; #ifdef __INTEL_COMPILER #pragma warning pop #endif @@ -163,8 +166,7 @@ public: template struct is_convertible { - enum { value = is_convertible_impl::type, - typename remove_all::type>::value }; + enum { value = is_convertible_impl::value }; }; /** \internal Allows to enable/disable an overload -- cgit v1.2.3