annotate DEPENDENCIES/generic/include/boost/multiprecision/traits/is_restricted_conversion.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 ///////////////////////////////////////////////////////////////////////////////
Chris@16 2 // Copyright Vicente J. Botet Escriba 2009-2011
Chris@16 3 // Copyright 2012 John Maddock. Distributed under the Boost
Chris@16 4 // Software License, Version 1.0. (See accompanying file
Chris@16 5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 6
Chris@16 7 #ifndef BOOST_MP_RESTRICTED_CONVERSION_HPP
Chris@16 8 #define BOOST_MP_RESTRICTED_CONVERSION_HPP
Chris@16 9
Chris@16 10 #include <boost/multiprecision/traits/explicit_conversion.hpp>
Chris@16 11 #include <boost/mpl/if.hpp>
Chris@16 12 #include <boost/multiprecision/detail/number_base.hpp>
Chris@16 13
Chris@16 14 namespace boost{ namespace multiprecision{ namespace detail{
Chris@16 15
Chris@16 16
Chris@16 17 template <class From, class To>
Chris@16 18 struct is_lossy_conversion
Chris@16 19 {
Chris@16 20 typedef typename mpl::if_c<
Chris@16 21 ((number_category<From>::value == number_kind_floating_point) && (number_category<To>::value == number_kind_integer))
Chris@101 22 /* || ((number_category<From>::value == number_kind_floating_point) && (number_category<To>::value == number_kind_rational))*/
Chris@16 23 || ((number_category<From>::value == number_kind_rational) && (number_category<To>::value == number_kind_integer))
Chris@16 24 || ((number_category<From>::value == number_kind_fixed_point) && (number_category<To>::value == number_kind_integer))
Chris@16 25 || (number_category<From>::value == number_kind_unknown)
Chris@16 26 || (number_category<To>::value == number_kind_unknown),
Chris@16 27 mpl::true_,
Chris@16 28 mpl::false_
Chris@16 29 >::type type;
Chris@16 30 static const bool value = type::value;
Chris@16 31 };
Chris@16 32
Chris@16 33 template<typename From, typename To>
Chris@16 34 struct is_restricted_conversion
Chris@16 35 {
Chris@16 36 typedef typename mpl::if_c<
Chris@16 37 ((is_explicitly_convertible<From, To>::value && !is_convertible<From, To>::value)
Chris@16 38 || is_lossy_conversion<From, To>::value),
Chris@16 39 mpl::true_,
Chris@16 40 mpl::false_
Chris@16 41 >::type type;
Chris@16 42 static const bool value = type::value;
Chris@16 43 };
Chris@16 44
Chris@16 45 }}} // namespaces
Chris@16 46
Chris@16 47 #endif // BOOST_MP_RESTRICTED_CONVERSION_HPP
Chris@16 48