diff options
author | Gael Guennebaud <g.gael@free.fr> | 2018-07-12 09:57:19 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2018-07-12 09:57:19 +0200 |
commit | 21cf4a1a8b0868b6dcb74aa4ebe6317d5316b2e1 (patch) | |
tree | 447fb61ad27dd4dec4707c031a8202a30d5f4778 /Eigen/src/Core | |
parent | 8a5955a052f64fc32099b052a221e0b5a8e92cbd (diff) |
Make is_convertible more robust and conformant to std::is_convertible
Diffstat (limited to 'Eigen/src/Core')
-rwxr-xr-x | Eigen/src/Core/util/Meta.h | 12 |
1 files changed, 7 insertions, 5 deletions
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<typename T> + static yes test(T, int); + + template<typename T> 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<To>(*ms_from, 0))==sizeof(yes) }; #ifdef __INTEL_COMPILER #pragma warning pop #endif @@ -163,8 +166,7 @@ public: template<typename From, typename To> struct is_convertible { - enum { value = is_convertible_impl<typename remove_all<From>::type, - typename remove_all<To >::type>::value }; + enum { value = is_convertible_impl<From,To>::value }; }; /** \internal Allows to enable/disable an overload |