/////////////////////////////////////////////////////////////////////////////// // 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_IS_RESTRICTED_CONVERSION_HPP #define BOOST_MP_IS_RESTRICTED_CONVERSION_HPP #include #include namespace boost { namespace multiprecision { namespace detail { template struct is_lossy_conversion { static constexpr bool category_conditional_is_true = ( (static_cast(number_category::value) == number_kind_floating_point) && (static_cast(number_category::value) == number_kind_integer)) || ( (static_cast(number_category::value) == number_kind_rational) && (static_cast(number_category::value) == number_kind_integer)) || ( (static_cast(number_category::value) == number_kind_fixed_point) && (static_cast(number_category::value) == number_kind_integer)) || (static_cast(number_category::value) == number_kind_unknown) || (static_cast(number_category::value) == number_kind_unknown); using type = typename std::conditional, std::integral_constant>::type; static constexpr bool value = type::value; }; template struct is_restricted_conversion { using type = typename std::conditional< ((is_explicitly_convertible::value && !std::is_convertible::value) || is_lossy_conversion::value), std::integral_constant, std::integral_constant>::type; static constexpr const bool value = type::value; }; }}} // namespace boost::multiprecision::detail #endif // BOOST_MP_IS_RESTRICTED_CONVERSION_HPP