Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: // Copyright Vicente J. Botet Escriba 2009-2011 Chris@16: // Copyright 2012 John Maddock. Distributed under the Boost Chris@16: // Software License, Version 1.0. (See accompanying file Chris@16: // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: #ifndef BOOST_MP_RESTRICTED_CONVERSION_HPP Chris@16: #define BOOST_MP_RESTRICTED_CONVERSION_HPP Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost{ namespace multiprecision{ namespace detail{ Chris@16: Chris@16: Chris@16: template Chris@16: struct is_lossy_conversion Chris@16: { Chris@16: typedef typename mpl::if_c< Chris@16: ((number_category::value == number_kind_floating_point) && (number_category::value == number_kind_integer)) Chris@101: /* || ((number_category::value == number_kind_floating_point) && (number_category::value == number_kind_rational))*/ Chris@16: || ((number_category::value == number_kind_rational) && (number_category::value == number_kind_integer)) Chris@16: || ((number_category::value == number_kind_fixed_point) && (number_category::value == number_kind_integer)) Chris@16: || (number_category::value == number_kind_unknown) Chris@16: || (number_category::value == number_kind_unknown), Chris@16: mpl::true_, Chris@16: mpl::false_ Chris@16: >::type type; Chris@16: static const bool value = type::value; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct is_restricted_conversion Chris@16: { Chris@16: typedef typename mpl::if_c< Chris@16: ((is_explicitly_convertible::value && !is_convertible::value) Chris@16: || is_lossy_conversion::value), Chris@16: mpl::true_, Chris@16: mpl::false_ Chris@16: >::type type; Chris@16: static const bool value = type::value; Chris@16: }; Chris@16: Chris@16: }}} // namespaces Chris@16: Chris@16: #endif // BOOST_MP_RESTRICTED_CONVERSION_HPP Chris@16: