/////////////////////////////////////////////////////////////////////////////// // Copyright 2015 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_BACKEND_HPP #define BOOST_MP_IS_BACKEND_HPP #include #include #include #include namespace boost { namespace multiprecision { namespace detail { BOOST_MPL_HAS_XXX_TRAIT_DEF(signed_types) BOOST_MPL_HAS_XXX_TRAIT_DEF(unsigned_types) BOOST_MPL_HAS_XXX_TRAIT_DEF(float_types) template struct is_backend { static const bool value = has_signed_types::value && has_unsigned_types::value && has_float_types::value; }; template struct other_backend { typedef typename boost::conditional< boost::is_same, number >::value, number, number >::type type; }; template struct number_from_backend { typedef typename boost::conditional< boost::is_convertible >::value, number, typename other_backend::type>::type type; }; template struct is_first_backend_imp { static const bool value = false; }; template struct is_first_backend_imp { static const bool value = is_convertible >::value || is_convertible >::value; }; template struct is_first_backend : is_first_backend_imp::value, T, U> {}; template struct is_second_backend_imp { static const bool value = false; }; template struct is_second_backend_imp { static const bool value = (is_convertible >::value || is_convertible >::value) && !is_first_backend::value; }; template struct is_second_backend : is_second_backend_imp::value, T, U> {}; } } } // namespace boost::multiprecision::detail #endif // BOOST_MP_IS_BACKEND_HPP