diff --git a/Eigen/src/Core/util/Meta.h b/Eigen/src/Core/util/Meta.h index db948cea1..fe9550d71 100755 --- a/Eigen/src/Core/util/Meta.h +++ b/Eigen/src/Core/util/Meta.h @@ -174,6 +174,11 @@ template struct add_const_on_value_type { typedef T const template struct add_const_on_value_type { typedef T const* const type; }; template struct add_const_on_value_type { typedef T const* const type; }; +#if EIGEN_HAS_CXX11 + +using std::is_convertible; + +#else template struct is_convertible_impl @@ -211,6 +216,14 @@ struct is_convertible enum { value = is_convertible_impl::value }; }; +template +struct is_convertible { enum { value = false }; }; + +template +struct is_convertible { enum { value = true }; }; + +#endif + /** \internal Allows to enable/disable an overload * according to a compile time condition. */ diff --git a/test/meta.cpp b/test/meta.cpp index 51395acd0..b432d9316 100644 --- a/test/meta.cpp +++ b/test/meta.cpp @@ -87,8 +87,12 @@ EIGEN_DECLARE_TEST(meta) STATIC_CHECK(( internal::is_convertible::value )); STATIC_CHECK((!internal::is_convertible::value )); STATIC_CHECK((!internal::is_convertible::value )); - STATIC_CHECK(( internal::is_convertible::value )); // std::is_convertible returns false here though Matrix3f from; Matrix3f& to = from; is valid. - //STATIC_CHECK((!internal::is_convertible::value )); //does not work because the conversion is prevented by a static assertion + STATIC_CHECK(!( internal::is_convertible::value )); + + STATIC_CHECK(!( internal::is_convertible::value )); + STATIC_CHECK(( internal::is_convertible::value )); + + //STATIC_CHECK((!internal::is_convertible::value )); //does not even compile because the conversion is prevented by a static assertion STATIC_CHECK((!internal::is_convertible::value )); STATIC_CHECK((!internal::is_convertible::value )); {