Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:42:24

0001 ///////////////////////////////////////////////////////////////////////////////
0002 //  Copyright 2021 John Maddock. Distributed under the Boost
0003 //  Software License, Version 1.0. (See accompanying file
0004 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 #ifndef BOOST_IS_CONVERTIBLE_ARITHMETIC_HPP
0007 #define BOOST_IS_CONVERTIBLE_ARITHMETIC_HPP
0008 
0009 #include <type_traits>
0010 #include <boost/multiprecision/detail/number_base.hpp>
0011 #include <boost/multiprecision/detail/standalone_config.hpp>
0012 
0013 namespace boost { namespace multiprecision { namespace detail {
0014 
0015 template <class V, class Backend>
0016 struct is_convertible_arithmetic
0017 {
0018    static constexpr bool value = boost::multiprecision::detail::is_arithmetic<V>::value;
0019 };
0020 //
0021 // For extension types, we don't *require* interoperability, 
0022 // so only enable it if we can convert the type to the backend
0023 // losslessly, ie not via conversion to a narrower type.
0024 // Note that backends with templated constructors/=operators
0025 // will not be selected here, so these need to either specialize
0026 // this trait, or provide a proper non-template constructor/=operator
0027 // for the extension types it supports.
0028 //
0029 #ifdef BOOST_HAS_FLOAT128
0030 template <class Backend>
0031 struct is_convertible_arithmetic<float128_type, Backend>
0032 {
0033    static constexpr bool value = std::is_assignable<Backend, convertible_to<float128_type>>::value;
0034 };
0035 #endif
0036 #ifdef BOOST_HAS_INT128
0037 template <class Backend>
0038 struct is_convertible_arithmetic<int128_type, Backend>
0039 {
0040    static constexpr bool value = std::is_assignable<Backend, convertible_to<int128_type>>::value;
0041 };
0042 template <class Backend>
0043 struct is_convertible_arithmetic<uint128_type, Backend>
0044 {
0045    static constexpr bool value = std::is_assignable<Backend, convertible_to<uint128_type>>::value;
0046 };
0047 #endif
0048 
0049 }}} // namespace boost::multiprecision::detail
0050 
0051 #endif // BOOST_IS_BYTE_CONTAINER_HPP