/////////////////////////////////////////////////////////////////////////////// // Copyright Vicente J. Botet Escriba 2009-2011 // Copyright 2012 John Maddock. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_MP_EXPLICIT_CONVERSION_HPP #define BOOST_MP_EXPLICIT_CONVERSION_HPP #include #include #include // number_category namespace boost { namespace multiprecision { namespace detail { template struct dummy_size {}; template struct has_generic_interconversion { using type = typename std::conditional< is_number::value && is_number::value, typename std::conditional< number_category::value == number_kind_integer, typename std::conditional< number_category::value == number_kind_integer || number_category::value == number_kind_floating_point || number_category::value == number_kind_rational || number_category::value == number_kind_fixed_point, std::true_type, std::false_type >::type, typename std::conditional< number_category::value == number_kind_rational, typename std::conditional< number_category::value == number_kind_rational || number_category::value == number_kind_rational, std::true_type, std::false_type >::type, typename std::conditional< number_category::value == number_kind_floating_point, std::true_type, std::false_type >::type>::type>::type, std::false_type >::type; }; template struct is_explicitly_convertible_imp { template static int selector(dummy_size(sizeof(new T1(std::declval())))>*); template static char selector(...); static constexpr bool value = sizeof(selector(nullptr)) == sizeof(int); using type = std::integral_constant; }; template struct is_explicitly_convertible : public is_explicitly_convertible_imp::type { }; }}} // namespace boost::multiprecision::detail #endif