File indexing completed on 2025-01-18 09:42:24
0001
0002
0003
0004
0005
0006
0007 #ifndef BOOST_MP_STD_INTEGER_TRAITS_HPP
0008 #define BOOST_MP_STD_INTEGER_TRAITS_HPP
0009
0010 #include <type_traits>
0011 #include <boost/multiprecision/detail/standalone_config.hpp>
0012
0013 namespace boost {
0014 namespace multiprecision {
0015 namespace detail {
0016
0017 template <class T>
0018 struct is_signed : public std::is_signed<T> {};
0019 template <class T>
0020 struct is_unsigned : public std::is_unsigned<T> {};
0021 template <class T>
0022 struct is_integral : public std::is_integral<T> {};
0023 template <class T>
0024 struct is_arithmetic : public std::is_arithmetic<T> {};
0025 template <class T>
0026 struct make_unsigned : public std::make_unsigned<T> {};
0027 template <class T>
0028 struct make_signed : public std::make_signed<T> {};
0029
0030 #ifdef BOOST_HAS_INT128
0031
0032 template <>
0033 struct is_signed<int128_type> : public std::true_type {};
0034 template <>
0035 struct is_signed<uint128_type> : public std::false_type {};
0036 template <>
0037 struct is_unsigned<int128_type> : public std::false_type {};
0038 template <>
0039 struct is_unsigned<uint128_type> : public std::true_type {};
0040 template <>
0041 struct is_integral<int128_type> : public std::true_type {};
0042 template <>
0043 struct is_integral<uint128_type> : public std::true_type {};
0044 template <>
0045 struct is_arithmetic<int128_type> : public std::true_type {};
0046 template <>
0047 struct is_arithmetic<uint128_type> : public std::true_type {};
0048 template <>
0049 struct make_unsigned<int128_type>
0050 {
0051 using type = uint128_type;
0052 };
0053 template <>
0054 struct make_unsigned<uint128_type>
0055 {
0056 using type = uint128_type;
0057 };
0058 template <>
0059 struct make_signed<int128_type>
0060 {
0061 using type = int128_type;
0062 };
0063 template <>
0064 struct make_signed<uint128_type>
0065 {
0066 using type = int128_type;
0067 };
0068
0069 #endif
0070
0071
0072 #if defined(__cpp_variable_templates) && __cpp_variable_templates >= 201304L
0073 template <typename T>
0074 BOOST_INLINE_CONSTEXPR bool is_signed_v = is_signed<T>::value;
0075 template <typename T>
0076 BOOST_INLINE_CONSTEXPR bool is_unsigned_v = is_unsigned<T>::value;
0077 template <typename T>
0078 BOOST_INLINE_CONSTEXPR bool is_integral_v = is_integral<T>::value;
0079 template <typename T>
0080 BOOST_INLINE_CONSTEXPR bool is_arithmetic_v = is_arithmetic<T>::value;
0081 #endif
0082
0083 template <typename T>
0084 using make_unsigned_t = typename make_unsigned<T>::type;
0085 template <typename T>
0086 using make_signed_t = typename make_signed<T>::type;
0087
0088 }}}
0089
0090 #endif