diff --git a/doc/reference_backend_requirements.qbk b/doc/reference_backend_requirements.qbk index fe6a21eb..ee8da051 100644 --- a/doc/reference_backend_requirements.qbk +++ b/doc/reference_backend_requirements.qbk @@ -30,11 +30,11 @@ and `ff` is a variable of type `std::ios_base::fmtflags`. [table Compulsory Requirements on the Backend type. [[Expression][Return Type][Comments][Throws]] -[[`B::signed_types`][`mpl::list`][A list of signed integral types that can be assigned to type B. The types shall be +[[`B::signed_types`][`std::tuple`][A list of signed integral types that can be assigned to type B. The types shall be listed in order of size, smallest first, and shall terminate in the type that is `std::intmax_t`.][[space]]] -[[`B::unsigned_types`][`mpl::list`][A list of unsigned integral types that can be assigned to type B. The types shall be +[[`B::unsigned_types`][`std::tuple`][A list of unsigned integral types that can be assigned to type B. The types shall be listed in order of size, smallest first, and shall terminate in the type that is `std::uintmax_t`.][[space]]] -[[`B::float_types`][`mpl::list`][A list of floating-point types that can be assigned to type B.The types shall be +[[`B::float_types`][`std::tuple`][A list of floating-point types that can be assigned to type B.The types shall be listed in order of size, smallest first, and shall terminate in type `long double`.][[space]]] [[`B::exponent_type`][A signed integral type.][The type of the exponent of type B. This type is required only for floating-point types.][[space]]] [[`B()`][ ][Default constructor.][[space]]] @@ -77,7 +77,7 @@ and `ff` is a variable of type `std::ios_base::fmtflags`. [[`eval_floor(b, cb)`][`void`][Stores the floor of `cb` in `b`, only required when `B` is a floating-point type.][[space]]] [[`eval_ceil(b, cb)`][`void`][Stores the ceiling of `cb` in `b`, only required when `B` is a floating-point type.][[space]]] [[`eval_sqrt(b, cb)`][`void`][Stores the square root of `cb` in `b`, only required when `B` is a floating-point type.][[space]]] -[[`boost::multiprecision::number_category::type`][`mpl::int_`][`N` is one of the values `number_kind_integer`, `number_kind_floating_point`, `number_kind_complex`, `number_kind_rational` or `number_kind_fixed_point`. +[[`boost::multiprecision::number_category::type`][`std::integral_constant`][`N` is one of the values `number_kind_integer`, `number_kind_floating_point`, `number_kind_complex`, `number_kind_rational` or `number_kind_fixed_point`. Defaults to `number_kind_floating_point`.][[space]]] [[`eval_conj(b, cb)`][`void`][Sets `b` to the complex conjugate of `cb`. Required for complex types only - other types have a sensible default.][[space]]] [[`eval_proj(b, cb)`][`void`][Sets `b` to the Riemann projection of `cb`. Required for complex types only - other types have a sensible default.][[space]]] @@ -141,11 +141,11 @@ and `ff` is a variable of type `std::ios_base::fmtflags`. When not provided, the default implementation returns `eval_lt(cb, a)`.][[space]]] [[`eval_is_zero(cb)`][`bool`][Returns `true` if `cb` is zero, otherwise `false`. The default version of this function returns `cb.compare(ui_type(0)) == 0`, where `ui_type` is `ui_type` is - `typename mpl::front::type`.][[space]]] + `typename std::tuple_element<0, typename B::unsigned_types>::type`.][[space]]] [[`eval_get_sign(cb)`][`int`][Returns a value < zero if `cb` is negative, a value > zero if `cb` is positive, and zero if `cb` is zero. The default version of this function returns `cb.compare(ui_type(0))`, where `ui_type` is `ui_type` is - `typename mpl::front::type`.][[space]]] + `typename std::tuple_element<0, typename B::unsigned_types>::type`.][[space]]] [[['Basic arithmetic:]]] [[`eval_add(b, a)`][`void`][Adds `a` to `b`. The type of `a` shall be listed in one of the type lists @@ -234,10 +234,10 @@ and `ff` is a variable of type `std::ios_base::fmtflags`. [`std::overflow_error` if cb has the value zero, and `std::numeric_limits >::has_infinity == false`]] [[`eval_increment(b)`][void][Increments the value of `b` by one. When not provided, does the equivalent of `eval_add(b, static_cast(1u))`. - Where `ui_type` is `typename mpl::front::type`.][[space]]] + Where `ui_type` is `typename std::tuple_element<0, typename B::unsigned_types>::type`.][[space]]] [[`eval_decrement(b)`][void][Decrements the value of `b` by one. When not provided, does the equivalent of `eval_subtract(b, static_cast(1u))`. - Where `ui_type` is `typename mpl::front::type`.][[space]]] + Where `ui_type` is `typename std::tuple_element<0, typename B::unsigned_types>::type`.][[space]]] [[['Integer specific operations:]]] [[`eval_modulus(b, a)`][`void`][Computes `b %= cb`, only required when `B` is an integer type. The type of `a` shall be listed in one of the type lists diff --git a/doc/reference_cpp_bin_float.qbk b/doc/reference_cpp_bin_float.qbk index da35c732..0bc41bf7 100644 --- a/doc/reference_cpp_bin_float.qbk +++ b/doc/reference_cpp_bin_float.qbk @@ -51,7 +51,7 @@ given the limitations of the type and our internal requirements".]] given the limitations of the type and our internal requirements".]] ] -The type of `number_category >::type` is `mpl::int_`. +The type of `number_category >::type` is `std::integral_constant`. More information on this type can be found in the [link boost_multiprecision.tut.floats.cpp_bin_float tutorial]. diff --git a/doc/reference_cpp_dec_float.qbk b/doc/reference_cpp_dec_float.qbk index 778b9111..4cdcabcc 100644 --- a/doc/reference_cpp_dec_float.qbk +++ b/doc/reference_cpp_dec_float.qbk @@ -35,7 +35,7 @@ template argument should not be set too high or the class's size will grow unrea allocation is performed, but can be set to a standard library allocator if dynamic allocation makes more sense.]] ] -The type of `number_category >::type` is `mpl::int_`. +The type of `number_category >::type` is `std::integral_constant`. More information on this type can be found in the [link boost_multiprecision.tut.floats.cpp_dec_float tutorial]. diff --git a/doc/reference_cpp_int.qbk b/doc/reference_cpp_int.qbk index 58fc451b..08337933 100644 --- a/doc/reference_cpp_int.qbk +++ b/doc/reference_cpp_int.qbk @@ -90,7 +90,7 @@ The template arguments are: [[Allocator][The allocator to use for dynamic memory allocation, or type `void` if MaxBits == MinBits.]] ] -The type of `number_category >::type` is `mpl::int_`. +The type of `number_category >::type` is `std::integral_constant`. More information on this type can be found in the [link boost_multiprecision.tut.ints.cpp_int tutorial]. diff --git a/doc/reference_gmp_float.qbk b/doc/reference_gmp_float.qbk index e340687e..f8a613e2 100644 --- a/doc/reference_gmp_float.qbk +++ b/doc/reference_gmp_float.qbk @@ -33,7 +33,7 @@ and `number::precision`. Note that this type does not in any way change the GMP it does not change the default precision of the mpf_t data type), therefore you can safely mix this type with existing code that uses GMP, and also mix `gmp_float`s of differing precision. -The type of `number_category >::type` is `mpl::int_`. +The type of `number_category >::type` is `std::integral_constant`. More information on this type can be found in the [link boost_multiprecision.tut.floats.gmp_float tutorial]. diff --git a/doc/reference_gmp_int.qbk b/doc/reference_gmp_int.qbk index dc1c98dc..3b9be993 100644 --- a/doc/reference_gmp_int.qbk +++ b/doc/reference_gmp_int.qbk @@ -22,7 +22,7 @@ Class template `gmp_int` fulfils all of the requirements for a [link boost_multi Its members and non-member functions are deliberately not documented: these are considered implementation details that are subject to change. -The type of `number_category >::type` is `mpl::int_`. +The type of `number_category >::type` is `std::integral_constant`. More information on this type can be found in the [link boost_multiprecision.tut.ints.gmp_int tutorial]. diff --git a/doc/reference_internal_support.qbk b/doc/reference_internal_support.qbk index 8c778e2f..9bbf05e8 100644 --- a/doc/reference_internal_support.qbk +++ b/doc/reference_internal_support.qbk @@ -50,7 +50,7 @@ authors of backend types should generally specialise one of the traits above, ra template is_unsigned_number; -These two traits inherit from either `mpl::true_` or `mpl::false_`, by default types are assumed to be signed unless +These two traits inherit from either `std::integral_constant` or `std::integral_constant`, by default types are assumed to be signed unless `is_unsigned_number` is specialized for that type. [endsect] diff --git a/doc/reference_mpfr_float.qbk b/doc/reference_mpfr_float.qbk index 9ed1f5fc..7b91438e 100644 --- a/doc/reference_mpfr_float.qbk +++ b/doc/reference_mpfr_float.qbk @@ -33,7 +33,7 @@ and `number::precision`. Note that this type does not in any way change the GMP it does not change the default precision of the mpfr_t data type), therefore you can safely mix this type with existing code that uses GMP or MPFR, and also mix `mpfr_float_backend`s of differing precision. -The type of `number_category >::type` is `mpl::int_`. +The type of `number_category >::type` is `std::integral_constant`. More information on this type can be found in the [link boost_multiprecision.tut.floats.mpfr_float tutorial]. diff --git a/doc/reference_number.qbk b/doc/reference_number.qbk index 2e0496c1..bf7d5bf1 100644 --- a/doc/reference_number.qbk +++ b/doc/reference_number.qbk @@ -694,7 +694,7 @@ If this is a type with multiple components (for example rational or complex type template struct number_category; -A traits class that inherits from `mpl::int_` where `N` is one of the enumerated values `number_kind_integer`, `number_kind_floating_point`, +A traits class that inherits from `std::integral_constant` where `N` is one of the enumerated values `number_kind_integer`, `number_kind_floating_point`, `number_kind_rational`, `number_kind_fixed_point`, or `number_kind_unknown`. This traits class is specialized for any type that has `std::numeric_limits` support as well as for classes in this library: which means it can be used for generic code that must work with __fundamental arithmetic types as well as multiprecision ones. @@ -702,12 +702,12 @@ with __fundamental arithmetic types as well as multiprecision ones. template struct is_number; -A traits class that inherits from `mpl::true_` if T is an instance of `number<>`, otherwise from `mpl::false_`. +A traits class that inherits from `std::integral_constant` if T is an instance of `number<>`, otherwise from `std::integral_constant`. template struct is_number_expression; -A traits class that inherits from `mpl::true_` if T is an expression template type derived from `number<>`, otherwise from `mpl::false_`. +A traits class that inherits from `std::integral_constant` if T is an expression template type derived from `number<>`, otherwise from `std::integral_constant`. [h4 Integer functions] diff --git a/doc/reference_tom_int.qbk b/doc/reference_tom_int.qbk index c4e8329b..995f8baf 100644 --- a/doc/reference_tom_int.qbk +++ b/doc/reference_tom_int.qbk @@ -22,7 +22,7 @@ Class template `tommath_int` fulfils all of the requirements for a [link boost_m Its members and non-member functions are deliberately not documented: these are considered implementation details that are subject to change. -The type of `number_category >::type` is `mpl::int_`. +The type of `number_category >::type` is `std::integral_constant`. More information on this type can be found in the [link boost_multiprecision.tut.ints.tom_int tutorial]. diff --git a/include/boost/multiprecision/complex_adaptor.hpp b/include/boost/multiprecision/complex_adaptor.hpp index d803270c..0a68f82c 100644 --- a/include/boost/multiprecision/complex_adaptor.hpp +++ b/include/boost/multiprecision/complex_adaptor.hpp @@ -88,7 +88,7 @@ struct complex_adaptor template complex_adaptor& operator=(const V& v) { - typedef typename mpl::front::type ui_type; + typedef typename std::tuple_element<0, unsigned_types>::type ui_type; m_real = v; m_imag = ui_type(0u); return *this; @@ -102,7 +102,7 @@ struct complex_adaptor } complex_adaptor& operator=(const char* s) { - typedef typename mpl::front::type ui_type; + typedef typename std::tuple_element<0, unsigned_types>::type ui_type; ui_type zero = 0u; using default_ops::eval_fpclassify; @@ -370,7 +370,7 @@ inline void eval_sqrt(complex_adaptor& result, const complex_adaptor= 0)) { - static const typename mpl::front::type zero = 0u; + static const typename std::tuple_element<0, typename Backend::unsigned_types>::type zero = 0u; eval_sqrt(result.real_data(), val.real_data()); result.imag_data() = zero; return; @@ -433,7 +433,7 @@ inline void eval_pow(complex_adaptor& result, const complex_adaptor::type one(1); + typename std::tuple_element<0, typename Backend::unsigned_types>::type one(1); result = one; return; } @@ -449,7 +449,7 @@ inline void eval_pow(complex_adaptor& result, const complex_adaptor >::infinity().backend(); result.real_data() = n; - typename mpl::front::type zero(0); + typename std::tuple_element<0, typename Backend::unsigned_types>::type zero(0); if (eval_is_zero(e.imag_data())) result.imag_data() = zero; else @@ -457,7 +457,7 @@ inline void eval_pow(complex_adaptor& result, const complex_adaptor::type zero(0); + typename std::tuple_element<0, typename Backend::unsigned_types>::type zero(0); result = zero; } return; @@ -480,7 +480,7 @@ inline void eval_exp(complex_adaptor& result, const complex_adaptor::type zero(0); + typename std::tuple_element<0, typename Backend::unsigned_types>::type zero(0); result.imag_data() = zero; return; } @@ -509,7 +509,7 @@ inline void eval_log(complex_adaptor& result, const complex_adaptor= 0)) { eval_log(result.real_data(), arg.real_data()); - typename mpl::front::type zero(0); + typename std::tuple_element<0, typename Backend::unsigned_types>::type zero(0); result.imag_data() = zero; return; } @@ -529,7 +529,7 @@ inline void eval_log10(complex_adaptor& result, const complex_adaptor::type ui_type; + typedef typename std::tuple_element<0, typename Backend::unsigned_types>::type ui_type; Backend ten; ten = ui_type(10); @@ -587,7 +587,7 @@ void tanh_imp(const T& r, const T& i, T& r_result, T& i_result) using default_ops::eval_fpclassify; using default_ops::eval_get_sign; - typedef typename boost::mpl::front::type ui_type; + typedef typename std::tuple_element<0, typename T::unsigned_types>::type ui_type; ui_type one(1); // // Set: @@ -671,7 +671,7 @@ inline void eval_asin(complex_adaptor& result, const complex_adaptor inline void eval_acos(complex_adaptor& result, const complex_adaptor& arg) { - typedef typename mpl::front::type ui_type; + typedef typename std::tuple_element<0, typename Backend::unsigned_types>::type ui_type; using default_ops::eval_asin; @@ -686,7 +686,7 @@ inline void eval_acos(complex_adaptor& result, const complex_adaptor inline void eval_atan(complex_adaptor& result, const complex_adaptor& arg) { - typedef typename mpl::front::type ui_type; + typedef typename std::tuple_element<0, typename Backend::unsigned_types>::type ui_type; ui_type one = (ui_type)1u; using default_ops::eval_add; @@ -751,7 +751,7 @@ inline void eval_cosh(complex_adaptor& result, const complex_adaptor inline void eval_asinh(complex_adaptor& result, const complex_adaptor& arg) { - typedef typename mpl::front::type ui_type; + typedef typename std::tuple_element<0, typename Backend::unsigned_types>::type ui_type; ui_type one = (ui_type)1u; using default_ops::eval_add; @@ -769,7 +769,7 @@ inline void eval_asinh(complex_adaptor& result, const complex_adaptor inline void eval_acosh(complex_adaptor& result, const complex_adaptor& arg) { - typedef typename mpl::front::type ui_type; + typedef typename std::tuple_element<0, typename Backend::unsigned_types>::type ui_type; ui_type one = (ui_type)1u; using default_ops::eval_add; @@ -794,7 +794,7 @@ inline void eval_acosh(complex_adaptor& result, const complex_adaptor inline void eval_atanh(complex_adaptor& result, const complex_adaptor& arg) { - typedef typename mpl::front::type ui_type; + typedef typename std::tuple_element<0, typename Backend::unsigned_types>::type ui_type; ui_type one = (ui_type)1u; using default_ops::eval_add; @@ -826,7 +826,7 @@ inline void eval_proj(complex_adaptor& result, const complex_adaptor::type ui_type; + typedef typename std::tuple_element<0, typename Backend::unsigned_types>::type ui_type; ui_type zero = (ui_type)0u; int c1 = eval_fpclassify(arg.real_data()); @@ -890,7 +890,7 @@ inline std::size_t hash_value(const complex_adaptor& val) using boost::multiprecision::backends::complex_adaptor; template -struct number_category > : public boost::mpl::int_ +struct number_category > : public std::integral_constant {}; template diff --git a/include/boost/multiprecision/concepts/mp_number_archetypes.hpp b/include/boost/multiprecision/concepts/mp_number_archetypes.hpp index b0bcd0e6..3fd980a7 100644 --- a/include/boost/multiprecision/concepts/mp_number_archetypes.hpp +++ b/include/boost/multiprecision/concepts/mp_number_archetypes.hpp @@ -13,7 +13,6 @@ #include #include #include -#include #include namespace boost { @@ -27,9 +26,9 @@ namespace concepts { struct number_backend_float_architype { - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; - typedef mpl::list float_types; + typedef std::tuple signed_types; + typedef std::tuple unsigned_types; + typedef std::tuple float_types; typedef int exponent_type; number_backend_float_architype() @@ -211,7 +210,7 @@ typedef boost::multiprecision::number mp_number_ } // namespace concepts template <> -struct number_category : public mpl::int_ +struct number_category : public std::integral_constant {}; }} // namespace boost::multiprecision diff --git a/include/boost/multiprecision/cpp_bin_float.hpp b/include/boost/multiprecision/cpp_bin_float.hpp index 59c0deb7..da985d64 100644 --- a/include/boost/multiprecision/cpp_bin_float.hpp +++ b/include/boost/multiprecision/cpp_bin_float.hpp @@ -92,7 +92,7 @@ class cpp_bin_float typedef typename rep_type::signed_types signed_types; typedef typename rep_type::unsigned_types unsigned_types; - typedef boost::mpl::list float_types; + typedef std::tuple float_types; typedef Exponent exponent_type; static const exponent_type max_exponent_limit = boost::integer_traits::const_max - 2 * static_cast(bit_count); @@ -324,7 +324,7 @@ class cpp_bin_float return *this; } - typedef typename mpl::front::type ui_type; + typedef typename std::tuple_element<0, unsigned_types>::type ui_type; m_data = static_cast(0u); m_sign = false; m_exponent = 0; @@ -384,7 +384,7 @@ class cpp_bin_float return *this; } - typedef typename mpl::front::type ui_type; + typedef typename std::tuple_element<0, unsigned_types>::type ui_type; m_data = static_cast(0u); m_sign = false; m_exponent = 0; @@ -452,7 +452,7 @@ class cpp_bin_float return *this; } - typedef typename mpl::front::type ui_type; + typedef typename std::tuple_element<0, unsigned_types>::type ui_type; m_data = static_cast(0u); m_sign = false; m_exponent = 0; @@ -1926,7 +1926,7 @@ using backends::digit_base_10; using backends::digit_base_2; template -struct number_category > : public boost::mpl::int_ +struct number_category > : public std::integral_constant {}; template @@ -1937,7 +1937,7 @@ struct expression_template_default struct is_equivalent_number_type, cpp_bin_float > - : public mpl::true_ {}; + : public std::integral_constant {}; typedef number > cpp_bin_float_50; typedef number > cpp_bin_float_100; @@ -1981,7 +1981,7 @@ class numeric_limits::type ui_type; + typedef typename std::tuple_element<0, typename number_type::backend_type::unsigned_types>::type ui_type; value.second.backend() = ui_type(1u); value.second.backend().exponent() = boost::multiprecision::cpp_bin_float::min_exponent; } @@ -2004,7 +2004,7 @@ class numeric_limits::type ui_type; + typedef typename std::tuple_element<0, typename int_backend_type::unsigned_types>::type ui_type; int_backend_type i; i = ui_type(1u); eval_left_shift(i, boost::multiprecision::cpp_bin_float::bit_count - 1); @@ -2036,7 +2036,7 @@ class numeric_limits::type ui_type; + typedef typename std::tuple_element<0, typename number_type::backend_type::unsigned_types>::type ui_type; value.first = true; value.second.backend() = ui_type(1u); value.second = ldexp(value.second, 1 - (int)digits); @@ -2053,7 +2053,7 @@ class numeric_limits::type ui_type; + typedef typename std::tuple_element<0, typename number_type::backend_type::unsigned_types>::type ui_type; value.second.backend() = ui_type(1u); value.second = ldexp(value.second, -1); } diff --git a/include/boost/multiprecision/cpp_dec_float.hpp b/include/boost/multiprecision/cpp_dec_float.hpp index 78404715..798e1aa3 100644 --- a/include/boost/multiprecision/cpp_dec_float.hpp +++ b/include/boost/multiprecision/cpp_dec_float.hpp @@ -56,7 +56,7 @@ class cpp_dec_float; } // namespace backends template -struct number_category > : public mpl::int_ +struct number_category > : public std::integral_constant {}; namespace backends { @@ -72,9 +72,9 @@ class cpp_dec_float static_assert(sizeof(ExponentType) > 1, "ExponentType is too small."); public: - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; - typedef mpl::list float_types; + typedef std::tuple signed_types; + typedef std::tuple unsigned_types; + typedef std::tuple float_types; typedef ExponentType exponent_type; static const std::int32_t cpp_dec_float_radix = 10L; diff --git a/include/boost/multiprecision/cpp_int.hpp b/include/boost/multiprecision/cpp_int.hpp index 4c9d78ee..29dc5ac0 100644 --- a/include/boost/multiprecision/cpp_int.hpp +++ b/include/boost/multiprecision/cpp_int.hpp @@ -103,7 +103,7 @@ struct is_trivial_cpp_int struct is_unsigned_number > - : public mpl::bool_<(SignType == unsigned_magnitude) || (SignType == unsigned_packed)> + : public std::integral_constant {}; namespace backends { @@ -128,10 +128,10 @@ struct is_implicit_cpp_int_conversion -struct is_non_throwing_cpp_int : public mpl::false_ +struct is_non_throwing_cpp_int : public std::integral_constant {}; template -struct is_non_throwing_cpp_int > : public mpl::true_ +struct is_non_throwing_cpp_int > : public std::integral_constant {}; // @@ -141,27 +141,27 @@ template struct is_fixed_precision; template struct is_fixed_precision > - : public mpl::bool_ >::value != UINT_MAX> + : public std::integral_constant >::value != UINT_MAX> {}; namespace detail { -inline BOOST_MP_CXX14_CONSTEXPR void verify_new_size(unsigned new_size, unsigned min_size, const mpl::int_&) +inline BOOST_MP_CXX14_CONSTEXPR void verify_new_size(unsigned new_size, unsigned min_size, const std::integral_constant&) { if (new_size < min_size) BOOST_THROW_EXCEPTION(std::overflow_error("Unable to allocate sufficient storage for the value of the result: value overflows the maximum allowable magnitude.")); } -inline BOOST_MP_CXX14_CONSTEXPR void verify_new_size(unsigned /*new_size*/, unsigned /*min_size*/, const mpl::int_&) {} +inline BOOST_MP_CXX14_CONSTEXPR void verify_new_size(unsigned /*new_size*/, unsigned /*min_size*/, const std::integral_constant&) {} template -inline BOOST_MP_CXX14_CONSTEXPR void verify_limb_mask(bool b, U limb, U mask, const mpl::int_&) +inline BOOST_MP_CXX14_CONSTEXPR void verify_limb_mask(bool b, U limb, U mask, const std::integral_constant&) { // When we mask out "limb" with "mask", do we loose bits? If so it's an overflow error: if (b && (limb & ~mask)) BOOST_THROW_EXCEPTION(std::overflow_error("Overflow in cpp_int arithmetic: there is insufficient precision in the target type to hold all of the bits of the result.")); } template -inline BOOST_MP_CXX14_CONSTEXPR void verify_limb_mask(bool /*b*/, U /*limb*/, U /*mask*/, const mpl::int_&) {} +inline BOOST_MP_CXX14_CONSTEXPR void verify_limb_mask(bool /*b*/, U /*limb*/, U /*mask*/, const std::integral_constant&) {} } // namespace detail @@ -179,7 +179,7 @@ struct cpp_int_base::type allocator_type; typedef typename std::allocator_traits::pointer limb_pointer; typedef typename std::allocator_traits::const_pointer const_limb_pointer; - typedef mpl::int_ checked_type; + typedef std::integral_constant checked_type; // // Interface invariants: @@ -528,7 +528,7 @@ struct cpp_int_base { typedef limb_type* limb_pointer; typedef const limb_type* const_limb_pointer; - typedef mpl::int_ checked_type; + typedef std::integral_constant checked_type; struct scoped_shared_storage { @@ -732,7 +732,7 @@ struct cpp_int_base { typedef limb_type* limb_pointer; typedef const limb_type* const_limb_pointer; - typedef mpl::int_ checked_type; + typedef std::integral_constant checked_type; struct scoped_shared_storage { @@ -886,11 +886,11 @@ struct cpp_int_base } private: - void check_negate(const mpl::int_&) + void check_negate(const std::integral_constant&) { BOOST_THROW_EXCEPTION(std::range_error("Attempt to negate an unsigned number.")); } - BOOST_MP_CXX14_CONSTEXPR void check_negate(const mpl::int_&) {} + BOOST_MP_CXX14_CONSTEXPR void check_negate(const std::integral_constant&) {} public: BOOST_MP_CXX14_CONSTEXPR void negate() BOOST_MP_NOEXCEPT_IF((Checked == unchecked)) @@ -961,7 +961,7 @@ struct cpp_int_base typedef typename trivial_limb_type::type local_limb_type; typedef local_limb_type* limb_pointer; typedef const local_limb_type* const_limb_pointer; - typedef mpl::int_ checked_type; + typedef std::integral_constant checked_type; struct scoped_shared_storage { @@ -985,7 +985,7 @@ struct cpp_int_base protected: template BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::value || (std::numeric_limits::is_specialized && (std::numeric_limits::digits <= (int)MinBits)))>::type - check_in_range(T val, const mpl::int_&) + check_in_range(T val, const std::integral_constant&) { typedef typename std::common_type::type, local_limb_type>::type common_type; @@ -994,7 +994,7 @@ struct cpp_int_base } template BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::value || (std::numeric_limits::is_specialized && (std::numeric_limits::digits <= (int)MinBits)))>::type - check_in_range(T val, const mpl::int_&) + check_in_range(T val, const std::integral_constant&) { using std::abs; typedef typename std::common_type::type common_type; @@ -1003,7 +1003,7 @@ struct cpp_int_base BOOST_THROW_EXCEPTION(std::range_error("The argument to a cpp_int constructor exceeded the largest value it can represent.")); } template - BOOST_MP_CXX14_CONSTEXPR void check_in_range(T, const mpl::int_&) BOOST_NOEXCEPT {} + BOOST_MP_CXX14_CONSTEXPR void check_in_range(T, const std::integral_constant&) BOOST_NOEXCEPT {} template BOOST_MP_CXX14_CONSTEXPR void check_in_range(T val) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval().check_in_range(std::declval(), checked_type()))) @@ -1140,7 +1140,7 @@ struct cpp_int_base local_limb_type m_data; - typedef mpl::int_ checked_type; + typedef std::integral_constant checked_type; // // Interface invariants: @@ -1150,7 +1150,7 @@ struct cpp_int_base protected: template BOOST_MP_CXX14_CONSTEXPR typename std::enable_if< !(std::numeric_limits::is_specialized && (std::numeric_limits::digits <= (int)MinBits))>::type - check_in_range(T val, const mpl::int_&, const std::integral_constant&) + check_in_range(T val, const std::integral_constant&, const std::integral_constant&) { typedef typename std::common_type::type common_type; @@ -1158,7 +1158,7 @@ struct cpp_int_base BOOST_THROW_EXCEPTION(std::range_error("The argument to a cpp_int constructor exceeded the largest value it can represent.")); } template - BOOST_MP_CXX14_CONSTEXPR void check_in_range(T val, const mpl::int_&, const std::integral_constant&) + BOOST_MP_CXX14_CONSTEXPR void check_in_range(T val, const std::integral_constant&, const std::integral_constant&) { typedef typename std::common_type::type common_type; @@ -1168,7 +1168,7 @@ struct cpp_int_base BOOST_THROW_EXCEPTION(std::range_error("The argument to an unsigned cpp_int constructor was negative.")); } template - BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR void check_in_range(T, const mpl::int_&, const std::integral_constant&) BOOST_NOEXCEPT {} + BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR void check_in_range(T, const std::integral_constant&, const std::integral_constant&) BOOST_NOEXCEPT {} template BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR void check_in_range(T val) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval().check_in_range(std::declval(), checked_type(), boost::multiprecision::detail::is_signed()))) @@ -1292,8 +1292,8 @@ struct is_allowed_cpp_int_base_conversion : public std::conditional< || std::is_same::value || std::is_same::value #endif || literals::detail::is_value_pack::value || (is_trivial_cpp_int::value && boost::multiprecision::detail::is_arithmetic::value), - mpl::true_, - mpl::false_>::type + std::integral_constant, + std::integral_constant>::type {}; // // Now the actual backend, normalising parameters passed to the base class: @@ -1317,25 +1317,25 @@ struct cpp_int_backend Allocator, is_trivial_cpp_int::value> base_type; - typedef mpl::bool_::value> trivial_tag; + typedef std::integral_constant::value> trivial_tag; public: - typedef typename mpl::if_< - trivial_tag, - mpl::list< + typedef typename std::conditional< + is_trivial_cpp_int::value, + std::tuple< signed char, short, int, long, boost::long_long_type, signed_double_limb_type>, - mpl::list >::type signed_types; - typedef typename mpl::if_< - trivial_tag, - mpl::list >::type signed_types; + typedef typename std::conditional< + is_trivial_cpp_int::value, + std::tuple, - mpl::list >::type unsigned_types; - typedef typename mpl::if_< - trivial_tag, - mpl::list, - mpl::list >::type float_types; - typedef mpl::int_ checked_type; + std::tuple >::type unsigned_types; + typedef typename std::conditional< + is_trivial_cpp_int::value, + std::tuple, + std::tuple >::type float_types; + typedef std::integral_constant checked_type; BOOST_MP_FORCEINLINE constexpr cpp_int_backend() BOOST_NOEXCEPT {} BOOST_MP_FORCEINLINE constexpr cpp_int_backend(const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF(std::is_void::value) : base_type(o) {} @@ -1367,7 +1367,7 @@ struct cpp_int_backend private: template - BOOST_MP_CXX14_CONSTEXPR void do_assign(const cpp_int_backend& other, mpl::true_ const&, mpl::true_ const&) + BOOST_MP_CXX14_CONSTEXPR void do_assign(const cpp_int_backend& other, std::integral_constant const&, std::integral_constant const&) { // Assigning trivial type to trivial type: this->check_in_range(*other.limbs()); @@ -1376,7 +1376,7 @@ struct cpp_int_backend this->normalize(); } template - BOOST_MP_CXX14_CONSTEXPR void do_assign(const cpp_int_backend& other, mpl::true_ const&, mpl::false_ const&) + BOOST_MP_CXX14_CONSTEXPR void do_assign(const cpp_int_backend& other, std::integral_constant const&, std::integral_constant const&) { // non-trivial to trivial narrowing conversion: double_limb_type v = *other.limbs(); @@ -1393,7 +1393,7 @@ struct cpp_int_backend this->normalize(); } template - BOOST_MP_CXX14_CONSTEXPR void do_assign(const cpp_int_backend& other, mpl::false_ const&, mpl::true_ const&) + BOOST_MP_CXX14_CONSTEXPR void do_assign(const cpp_int_backend& other, std::integral_constant const&, std::integral_constant const&) { // trivial to non-trivial, treat the trivial argument as if it were an unsigned arithmetic type, then set the sign afterwards: *this = static_cast< @@ -1403,7 +1403,7 @@ struct cpp_int_backend this->sign(other.sign()); } template - BOOST_MP_CXX14_CONSTEXPR void do_assign(const cpp_int_backend& other, mpl::false_ const&, mpl::false_ const&) + BOOST_MP_CXX14_CONSTEXPR void do_assign(const cpp_int_backend& other, std::integral_constant const&, std::integral_constant const&) { // regular non-trivial to non-trivial assign: this->resize(other.size(), other.size()); @@ -1437,8 +1437,8 @@ struct cpp_int_backend { do_assign( other, - mpl::bool_::value>(), - mpl::bool_ >::value>()); + std::integral_constant::value>(), + std::integral_constant >::value>()); } template explicit BOOST_MP_CXX14_CONSTEXPR cpp_int_backend( @@ -1448,8 +1448,8 @@ struct cpp_int_backend { do_assign( other, - mpl::bool_::value>(), - mpl::bool_ >::value>()); + std::integral_constant::value>(), + std::integral_constant >::value>()); } template BOOST_MP_CXX14_CONSTEXPR cpp_int_backend& operator=( @@ -1457,8 +1457,8 @@ struct cpp_int_backend { do_assign( other, - mpl::bool_::value>(), - mpl::bool_ >::value>()); + std::integral_constant::value>(), + std::integral_constant >::value>()); return *this; } constexpr cpp_int_backend(const cpp_int_backend& a, const literals::detail::negate_tag& tag) @@ -1484,7 +1484,7 @@ struct cpp_int_backend } private: template - BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::value>::type do_assign_arithmetic(A val, const mpl::true_&) + BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::value>::type do_assign_arithmetic(A val, const std::integral_constant&) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval().check_in_range(std::declval()))) { this->check_in_range(val); @@ -1493,7 +1493,7 @@ struct cpp_int_backend this->normalize(); } template - BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::value || !boost::multiprecision::detail::is_integral::value)>::type do_assign_arithmetic(A val, const mpl::true_&) + BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::value || !boost::multiprecision::detail::is_integral::value)>::type do_assign_arithmetic(A val, const std::integral_constant&) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval().check_in_range(std::declval())) && noexcept(std::declval().sign(true))) { this->check_in_range(val); @@ -1502,26 +1502,26 @@ struct cpp_int_backend this->normalize(); } template - BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::value>::type do_assign_arithmetic(A val, const mpl::true_&) + BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::value>::type do_assign_arithmetic(A val, const std::integral_constant&) { this->check_in_range(val); *this->limbs() = (val < 0) ? static_cast(boost::multiprecision::detail::abs(val)) : static_cast(val); this->sign(val < 0); this->normalize(); } - BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR void do_assign_arithmetic(limb_type i, const mpl::false_&) BOOST_NOEXCEPT + BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR void do_assign_arithmetic(limb_type i, const std::integral_constant&) BOOST_NOEXCEPT { this->resize(1, 1); *this->limbs() = i; this->sign(false); } - BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR void do_assign_arithmetic(signed_limb_type i, const mpl::false_&) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval().sign(true))) + BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR void do_assign_arithmetic(signed_limb_type i, const std::integral_constant&) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval().sign(true))) { this->resize(1, 1); *this->limbs() = static_cast(boost::multiprecision::detail::unsigned_abs(i)); this->sign(i < 0); } - BOOST_MP_CXX14_CONSTEXPR void do_assign_arithmetic(double_limb_type i, const mpl::false_&) BOOST_NOEXCEPT + BOOST_MP_CXX14_CONSTEXPR void do_assign_arithmetic(double_limb_type i, const std::integral_constant&) BOOST_NOEXCEPT { static_assert(sizeof(i) == 2 * sizeof(limb_type), "Failed integer size check"); static_assert(base_type::internal_limb_count >= 2, "Failed internal limb count"); @@ -1535,7 +1535,7 @@ struct cpp_int_backend this->resize(p[1] ? 2 : 1, p[1] ? 2 : 1); this->sign(false); } - BOOST_MP_CXX14_CONSTEXPR void do_assign_arithmetic(signed_double_limb_type i, const mpl::false_&) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval().sign(true))) + BOOST_MP_CXX14_CONSTEXPR void do_assign_arithmetic(signed_double_limb_type i, const std::integral_constant&) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval().sign(true))) { static_assert(sizeof(i) == 2 * sizeof(limb_type), "double limb type size check failed"); static_assert(base_type::internal_limb_count >= 2, "Failed internal limb count check"); @@ -1554,7 +1554,7 @@ struct cpp_int_backend this->sign(s); } - BOOST_MP_CXX14_CONSTEXPR void do_assign_arithmetic(long double a, const mpl::false_&) + BOOST_MP_CXX14_CONSTEXPR void do_assign_arithmetic(long double a, const std::integral_constant&) { using default_ops::eval_add; using default_ops::eval_subtract; @@ -1564,7 +1564,7 @@ struct cpp_int_backend if (a < 0) { - do_assign_arithmetic(-a, mpl::false_()); + do_assign_arithmetic(-a, std::integral_constant()); this->sign(true); return; } @@ -1620,7 +1620,7 @@ struct cpp_int_backend } private: - void do_assign_string(const char* s, const mpl::true_&) + void do_assign_string(const char* s, const std::integral_constant&) { std::size_t n = s ? std::strlen(s) : 0; *this = 0; @@ -1671,7 +1671,7 @@ struct cpp_int_backend if (isneg) this->negate(); } - void do_assign_string(const char* s, const mpl::false_&) + void do_assign_string(const char* s, const std::integral_constant&) { using default_ops::eval_add; using default_ops::eval_multiply; @@ -1838,7 +1838,7 @@ struct cpp_int_backend } private: - std::string do_get_trivial_string(std::ios_base::fmtflags f, const mpl::false_&) const + std::string do_get_trivial_string(std::ios_base::fmtflags f, const std::integral_constant&) const { typedef typename std::conditional::type io_type; if (this->sign() && (((f & std::ios_base::hex) == std::ios_base::hex) || ((f & std::ios_base::oct) == std::ios_base::oct))) @@ -1854,7 +1854,7 @@ struct cpp_int_backend result += ss.str(); return result; } - std::string do_get_trivial_string(std::ios_base::fmtflags f, const mpl::true_&) const + std::string do_get_trivial_string(std::ios_base::fmtflags f, const std::integral_constant&) const { // Even though we have only one limb, we can't do IO on it :-( int base = 10; @@ -1932,15 +1932,15 @@ struct cpp_int_backend } return result; } - std::string do_get_string(std::ios_base::fmtflags f, const mpl::true_&) const + std::string do_get_string(std::ios_base::fmtflags f, const std::integral_constant&) const { #ifdef BOOST_MP_NO_DOUBLE_LIMB_TYPE_IO - return do_get_trivial_string(f, mpl::bool_::value>()); + return do_get_trivial_string(f, std::integral_constant::value>()); #else - return do_get_trivial_string(f, mpl::bool_()); + return do_get_trivial_string(f, std::integral_constant()); #endif } - std::string do_get_string(std::ios_base::fmtflags f, const mpl::false_&) const + std::string do_get_string(std::ios_base::fmtflags f, const std::integral_constant&) const { using default_ops::eval_get_sign; int base = 10; @@ -2047,7 +2047,7 @@ struct cpp_int_backend private: template - void construct_from_container(const Container& c, const mpl::false_&) + void construct_from_container(const Container& c, const std::integral_constant&) { // // We assume that c is a sequence of (unsigned) bytes with the most significant byte first: @@ -2075,7 +2075,7 @@ struct cpp_int_backend } } template - BOOST_MP_CXX14_CONSTEXPR void construct_from_container(const Container& c, const mpl::true_&) + BOOST_MP_CXX14_CONSTEXPR void construct_from_container(const Container& c, const std::integral_constant&) { // // We assume that c is a sequence of (unsigned) bytes with the most significant byte first: @@ -2108,7 +2108,7 @@ struct cpp_int_backend construct_from_container(c, trivial_tag()); } template - BOOST_MP_CXX14_CONSTEXPR int compare_imp(const cpp_int_backend& o, const mpl::false_&, const mpl::false_&) const BOOST_NOEXCEPT + BOOST_MP_CXX14_CONSTEXPR int compare_imp(const cpp_int_backend& o, const std::integral_constant&, const std::integral_constant&) const BOOST_NOEXCEPT { if (this->sign() != o.sign()) return this->sign() ? -1 : 1; @@ -2121,19 +2121,19 @@ struct cpp_int_backend return result; } template - BOOST_MP_CXX14_CONSTEXPR int compare_imp(const cpp_int_backend& o, const mpl::true_&, const mpl::false_&) const + BOOST_MP_CXX14_CONSTEXPR int compare_imp(const cpp_int_backend& o, const std::integral_constant&, const std::integral_constant&) const { cpp_int_backend t(*this); return t.compare(o); } template - BOOST_MP_CXX14_CONSTEXPR int compare_imp(const cpp_int_backend& o, const mpl::false_&, const mpl::true_&) const + BOOST_MP_CXX14_CONSTEXPR int compare_imp(const cpp_int_backend& o, const std::integral_constant&, const std::integral_constant&) const { cpp_int_backend t(o); return compare(t); } template - BOOST_MP_CXX14_CONSTEXPR int compare_imp(const cpp_int_backend& o, const mpl::true_&, const mpl::true_&) const BOOST_NOEXCEPT + BOOST_MP_CXX14_CONSTEXPR int compare_imp(const cpp_int_backend& o, const std::integral_constant&, const std::integral_constant&) const BOOST_NOEXCEPT { if (this->sign()) { @@ -2154,8 +2154,8 @@ struct cpp_int_backend template BOOST_MP_CXX14_CONSTEXPR int compare(const cpp_int_backend& o) const BOOST_NOEXCEPT { - typedef mpl::bool_ >::value> t1; - typedef mpl::bool_ >::value> t2; + typedef std::integral_constant >::value> t1; + typedef std::integral_constant >::value> t2; return compare_imp(o, t1(), t2()); } template @@ -2210,7 +2210,7 @@ struct double_precision_type struct is_equivalent_number_type, backends::cpp_int_backend > - : public mpl::bool_, et_on> >::digits == std::numeric_limits, et_on> >::digits>{}; + : public std::integral_constant, et_on> >::digits == std::numeric_limits, et_on> >::digits>{}; template struct expression_template_default > @@ -2221,7 +2221,7 @@ struct expression_template_default -struct number_category > : public mpl::int_ +struct number_category > : public std::integral_constant {}; typedef number > cpp_int; diff --git a/include/boost/multiprecision/cpp_int/bitwise.hpp b/include/boost/multiprecision/cpp_int/bitwise.hpp index 18804b7a..f2808d32 100644 --- a/include/boost/multiprecision/cpp_int/bitwise.hpp +++ b/include/boost/multiprecision/cpp_int/bitwise.hpp @@ -18,7 +18,7 @@ namespace boost { namespace multiprecision { namespace backends { template BOOST_MP_CXX14_CONSTEXPR void is_valid_bitwise_op( cpp_int_backend& result, - const cpp_int_backend& o, const mpl::int_&) + const cpp_int_backend& o, const std::integral_constant&) { if (result.sign() || o.sign()) BOOST_THROW_EXCEPTION(std::range_error("Bitwise operations on negative values results in undefined behavior.")); @@ -27,11 +27,11 @@ BOOST_MP_CXX14_CONSTEXPR void is_valid_bitwise_op( template BOOST_MP_CXX14_CONSTEXPR void is_valid_bitwise_op( cpp_int_backend&, - const cpp_int_backend&, const mpl::int_&) {} + const cpp_int_backend&, const std::integral_constant&) {} template BOOST_MP_CXX14_CONSTEXPR void is_valid_bitwise_op( - const cpp_int_backend& result, const mpl::int_&) + const cpp_int_backend& result, const std::integral_constant&) { if (result.sign()) BOOST_THROW_EXCEPTION(std::range_error("Bitwise operations on negative values results in undefined behavior.")); @@ -39,17 +39,17 @@ BOOST_MP_CXX14_CONSTEXPR void is_valid_bitwise_op( template BOOST_MP_CXX14_CONSTEXPR void is_valid_bitwise_op( - const cpp_int_backend&, const mpl::int_&) {} + const cpp_int_backend&, const std::integral_constant&) {} template BOOST_MP_CXX14_CONSTEXPR void is_valid_bitwise_op( - cpp_int_backend&, const mpl::int_&) {} + cpp_int_backend&, const std::integral_constant&) {} template BOOST_MP_CXX14_CONSTEXPR void bitwise_op( CppInt1& result, const CppInt2& o, - Op op, const mpl::true_&) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int::value)) + Op op, const std::integral_constant&) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int::value)) { // // There are 4 cases: @@ -189,7 +189,7 @@ template BOOST_MP_CXX14_CONSTEXPR void bitwise_op( CppInt1& result, const CppInt2& o, - Op op, const mpl::false_&) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int::value)) + Op op, const std::integral_constant&) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int::value)) { // // Both arguments are unsigned types, very simple case handled as a special case. @@ -234,7 +234,7 @@ eval_bitwise_and( const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { bitwise_op(result, o, bit_and(), - mpl::bool_ < std::numeric_limits > >::is_signed || std::numeric_limits > >::is_signed > ()); + std::integral_constant > >::is_signed || std::numeric_limits > >::is_signed > ()); } template @@ -244,7 +244,7 @@ eval_bitwise_or( const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { bitwise_op(result, o, bit_or(), - mpl::bool_ < std::numeric_limits > >::is_signed || std::numeric_limits > >::is_signed > ()); + std::integral_constant > >::is_signed || std::numeric_limits > >::is_signed > ()); } template @@ -254,7 +254,7 @@ eval_bitwise_xor( const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { bitwise_op(result, o, bit_xor(), - mpl::bool_ < std::numeric_limits > >::is_signed || std::numeric_limits > >::is_signed > ()); + std::integral_constant > >::is_signed || std::numeric_limits > >::is_signed > ()); } // // Again for operands which are single limbs: diff --git a/include/boost/multiprecision/cpp_int/checked.hpp b/include/boost/multiprecision/cpp_int/checked.hpp index 9948c03f..0fbe8ed7 100644 --- a/include/boost/multiprecision/cpp_int/checked.hpp +++ b/include/boost/multiprecision/cpp_int/checked.hpp @@ -35,7 +35,7 @@ inline void raise_div_overflow() } template -inline BOOST_MP_CXX14_CONSTEXPR A checked_add_imp(A a, A b, const mpl::true_&) +inline BOOST_MP_CXX14_CONSTEXPR A checked_add_imp(A a, A b, const std::integral_constant&) { if (a > 0) { @@ -50,25 +50,25 @@ inline BOOST_MP_CXX14_CONSTEXPR A checked_add_imp(A a, A b, const mpl::true_&) return a + b; } template -inline BOOST_MP_CXX14_CONSTEXPR A checked_add_imp(A a, A b, const mpl::false_&) +inline BOOST_MP_CXX14_CONSTEXPR A checked_add_imp(A a, A b, const std::integral_constant&) { if ((integer_traits::const_max - b) < a) raise_add_overflow(); return a + b; } template -inline BOOST_MP_CXX14_CONSTEXPR A checked_add(A a, A b, const mpl::int_&) +inline BOOST_MP_CXX14_CONSTEXPR A checked_add(A a, A b, const std::integral_constant&) { - return checked_add_imp(a, b, mpl::bool_::value && boost::multiprecision::detail::is_integral::value > ()); + return checked_add_imp(a, b, std::integral_constant::value && boost::multiprecision::detail::is_integral::value > ()); } template -inline BOOST_MP_CXX14_CONSTEXPR A checked_add(A a, A b, const mpl::int_&) +inline BOOST_MP_CXX14_CONSTEXPR A checked_add(A a, A b, const std::integral_constant&) { return a + b; } template -inline BOOST_MP_CXX14_CONSTEXPR A checked_subtract_imp(A a, A b, const mpl::true_&) +inline BOOST_MP_CXX14_CONSTEXPR A checked_subtract_imp(A a, A b, const std::integral_constant&) { if (a > 0) { @@ -83,25 +83,25 @@ inline BOOST_MP_CXX14_CONSTEXPR A checked_subtract_imp(A a, A b, const mpl::true return a - b; } template -inline BOOST_MP_CXX14_CONSTEXPR A checked_subtract_imp(A a, A b, const mpl::false_&) +inline BOOST_MP_CXX14_CONSTEXPR A checked_subtract_imp(A a, A b, const std::integral_constant&) { if (a < b) raise_subtract_overflow(); return a - b; } template -inline BOOST_MP_CXX14_CONSTEXPR A checked_subtract(A a, A b, const mpl::int_&) +inline BOOST_MP_CXX14_CONSTEXPR A checked_subtract(A a, A b, const std::integral_constant&) { - return checked_subtract_imp(a, b, mpl::bool_::value && boost::multiprecision::detail::is_integral::value>()); + return checked_subtract_imp(a, b, std::integral_constant::value && boost::multiprecision::detail::is_integral::value>()); } template -inline BOOST_MP_CXX14_CONSTEXPR A checked_subtract(A a, A b, const mpl::int_&) +inline BOOST_MP_CXX14_CONSTEXPR A checked_subtract(A a, A b, const std::integral_constant&) { return a - b; } template -inline BOOST_MP_CXX14_CONSTEXPR A checked_multiply(A a, A b, const mpl::int_&) +inline BOOST_MP_CXX14_CONSTEXPR A checked_multiply(A a, A b, const std::integral_constant&) { BOOST_MP_USING_ABS if (a && (integer_traits::const_max / abs(a) < abs(b))) @@ -109,26 +109,26 @@ inline BOOST_MP_CXX14_CONSTEXPR A checked_multiply(A a, A b, const mpl::int_ -inline BOOST_MP_CXX14_CONSTEXPR A checked_multiply(A a, A b, const mpl::int_&) +inline BOOST_MP_CXX14_CONSTEXPR A checked_multiply(A a, A b, const std::integral_constant&) { return a * b; } template -inline BOOST_MP_CXX14_CONSTEXPR A checked_divide(A a, A b, const mpl::int_&) +inline BOOST_MP_CXX14_CONSTEXPR A checked_divide(A a, A b, const std::integral_constant&) { if (b == 0) raise_div_overflow(); return a / b; } template -inline BOOST_MP_CXX14_CONSTEXPR A checked_divide(A a, A b, const mpl::int_&) +inline BOOST_MP_CXX14_CONSTEXPR A checked_divide(A a, A b, const std::integral_constant&) { return a / b; } template -inline BOOST_MP_CXX14_CONSTEXPR A checked_left_shift(A a, boost::ulong_long_type shift, const mpl::int_&) +inline BOOST_MP_CXX14_CONSTEXPR A checked_left_shift(A a, boost::ulong_long_type shift, const std::integral_constant&) { if (a && shift) { @@ -138,7 +138,7 @@ inline BOOST_MP_CXX14_CONSTEXPR A checked_left_shift(A a, boost::ulong_long_type return a << shift; } template -inline BOOST_MP_CXX14_CONSTEXPR A checked_left_shift(A a, boost::ulong_long_type shift, const mpl::int_&) +inline BOOST_MP_CXX14_CONSTEXPR A checked_left_shift(A a, boost::ulong_long_type shift, const std::integral_constant&) { return (shift >= sizeof(A) * CHAR_BIT) ? 0 : a << shift; } diff --git a/include/boost/multiprecision/cpp_int/cpp_int_config.hpp b/include/boost/multiprecision/cpp_int/cpp_int_config.hpp index ac83a51a..04cd11c5 100644 --- a/include/boost/multiprecision/cpp_int/cpp_int_config.hpp +++ b/include/boost/multiprecision/cpp_int/cpp_int_config.hpp @@ -8,8 +8,6 @@ #include #include -#include -#include #include namespace boost { diff --git a/include/boost/multiprecision/cpp_int/import_export.hpp b/include/boost/multiprecision/cpp_int/import_export.hpp index de689643..5cddf307 100644 --- a/include/boost/multiprecision/cpp_int/import_export.hpp +++ b/include/boost/multiprecision/cpp_int/import_export.hpp @@ -12,7 +12,7 @@ namespace multiprecision { namespace detail { template -void assign_bits(Backend& val, Unsigned bits, unsigned bit_location, unsigned chunk_bits, const mpl::false_& tag) +void assign_bits(Backend& val, Unsigned bits, unsigned bit_location, unsigned chunk_bits, const std::integral_constant& tag) { unsigned limb = bit_location / (sizeof(limb_type) * CHAR_BIT); unsigned shift = bit_location % (sizeof(limb_type) * CHAR_BIT); @@ -42,7 +42,7 @@ void assign_bits(Backend& val, Unsigned bits, unsigned bit_location, unsigned ch } } template -void assign_bits(Backend& val, Unsigned bits, unsigned bit_location, unsigned chunk_bits, const mpl::true_&) +void assign_bits(Backend& val, Unsigned bits, unsigned bit_location, unsigned chunk_bits, const std::integral_constant&) { typedef typename Backend::local_limb_type local_limb_type; // @@ -66,7 +66,7 @@ void assign_bits(Backend& val, Unsigned bits, unsigned bit_location, unsigned ch } template -inline void resize_to_bit_size(cpp_int_backend& newval, unsigned bits, const mpl::false_&) +inline void resize_to_bit_size(cpp_int_backend& newval, unsigned bits, const std::integral_constant&) { unsigned limb_count = static_cast(bits / (sizeof(limb_type) * CHAR_BIT)); if (bits % (sizeof(limb_type) * CHAR_BIT)) @@ -78,7 +78,7 @@ inline void resize_to_bit_size(cpp_int_backend -inline void resize_to_bit_size(cpp_int_backend& newval, unsigned, const mpl::true_&) +inline void resize_to_bit_size(cpp_int_backend& newval, unsigned, const std::integral_constant&) { *newval.limbs() = 0; } @@ -177,7 +177,7 @@ import_bits( namespace detail { template -std::uintmax_t extract_bits(const Backend& val, unsigned location, unsigned count, const mpl::false_& tag) +std::uintmax_t extract_bits(const Backend& val, unsigned location, unsigned count, const std::integral_constant& tag) { unsigned limb = location / (sizeof(limb_type) * CHAR_BIT); unsigned shift = location % (sizeof(limb_type) * CHAR_BIT); @@ -194,7 +194,7 @@ std::uintmax_t extract_bits(const Backend& val, unsigned location, unsigned coun } template -inline std::uintmax_t extract_bits(const Backend& val, unsigned location, unsigned count, const mpl::true_&) +inline std::uintmax_t extract_bits(const Backend& val, unsigned location, unsigned count, const std::integral_constant&) { typename Backend::local_limb_type result = *val.limbs(); typename Backend::local_limb_type mask = count >= std::numeric_limits::digits ? ~static_cast(0) : (static_cast(1u) << count) - 1; diff --git a/include/boost/multiprecision/cpp_int/limits.hpp b/include/boost/multiprecision/cpp_int/limits.hpp index 62ad9013..097537a4 100644 --- a/include/boost/multiprecision/cpp_int/limits.hpp +++ b/include/boost/multiprecision/cpp_int/limits.hpp @@ -21,7 +21,7 @@ namespace detail { template inline BOOST_CXX14_CONSTEXPR_IF_DETECTION boost::multiprecision::number, ExpressionTemplates> -get_min(const boost::mpl::true_&, const boost::mpl::true_&, const boost::mpl::true_&) +get_min(const std::integral_constant&, const std::integral_constant&, const std::integral_constant&) { // Bounded, signed, and no allocator. typedef boost::multiprecision::number, ExpressionTemplates> result_type; @@ -37,7 +37,7 @@ get_min(const boost::mpl::true_&, const boost::mpl::true_&, const boost::mpl::tr template inline boost::multiprecision::number, ExpressionTemplates> -get_min(const boost::mpl::true_&, const boost::mpl::true_&, const boost::mpl::false_&) +get_min(const std::integral_constant&, const std::integral_constant&, const std::integral_constant&) { // Bounded, signed, and an allocator (can't be constexpr). typedef boost::multiprecision::number, ExpressionTemplates> result_type; @@ -48,7 +48,7 @@ get_min(const boost::mpl::true_&, const boost::mpl::true_&, const boost::mpl::fa template inline BOOST_CXX14_CONSTEXPR_IF_DETECTION boost::multiprecision::number, ExpressionTemplates> -get_min(const boost::mpl::true_&, const boost::mpl::false_&, const boost::mpl::true_&) +get_min(const std::integral_constant&, const std::integral_constant&, const std::integral_constant&) { // Bounded, unsigned, no allocator (can be constexpr): #ifdef BOOST_MP_NO_CONSTEXPR_DETECTION @@ -62,7 +62,7 @@ get_min(const boost::mpl::true_&, const boost::mpl::false_&, const boost::mpl::t template inline boost::multiprecision::number, ExpressionTemplates> -get_min(const boost::mpl::true_&, const boost::mpl::false_&, const boost::mpl::false_&) +get_min(const std::integral_constant&, const std::integral_constant&, const std::integral_constant&) { // Bounded and unsigned with allocator (no constexpr): static const boost::multiprecision::number, ExpressionTemplates> val(0u); @@ -71,7 +71,7 @@ get_min(const boost::mpl::true_&, const boost::mpl::false_&, const boost::mpl::f template inline boost::multiprecision::number, ExpressionTemplates> -get_min(const boost::mpl::false_&, const boost::mpl::true_&, const boost::mpl::bool_&) +get_min(const std::integral_constant&, const std::integral_constant&, const std::integral_constant&) { // Unbounded and signed, never constexpr because there must be an allocator. // There is no minimum value, just return 0: @@ -81,7 +81,7 @@ get_min(const boost::mpl::false_&, const boost::mpl::true_&, const boost::mpl::b template inline boost::multiprecision::number, ExpressionTemplates> -get_min(const boost::mpl::false_&, const boost::mpl::false_&, const boost::mpl::bool_&) +get_min(const std::integral_constant&, const std::integral_constant&, const std::integral_constant&) { // Unbound and unsigned, never constexpr because there must be an allocator. static const boost::multiprecision::number, ExpressionTemplates> val(0u); @@ -90,7 +90,7 @@ get_min(const boost::mpl::false_&, const boost::mpl::false_&, const boost::mpl:: template inline BOOST_CXX14_CONSTEXPR_IF_DETECTION boost::multiprecision::number, ExpressionTemplates> -get_max(const boost::mpl::true_&, const boost::mpl::true_&, const boost::mpl::true_&) +get_max(const std::integral_constant&, const std::integral_constant&, const std::integral_constant&) { // Bounded and signed, no allocator, can be constexpr. typedef boost::multiprecision::number, ExpressionTemplates> result_type; @@ -106,7 +106,7 @@ get_max(const boost::mpl::true_&, const boost::mpl::true_&, const boost::mpl::tr template inline boost::multiprecision::number, ExpressionTemplates> -get_max(const boost::mpl::true_&, const boost::mpl::true_&, const boost::mpl::false_&) +get_max(const std::integral_constant&, const std::integral_constant&, const std::integral_constant&) { // Bounded and signed, has an allocator, never constexpr. typedef boost::multiprecision::number, ExpressionTemplates> result_type; @@ -117,7 +117,7 @@ get_max(const boost::mpl::true_&, const boost::mpl::true_&, const boost::mpl::fa template inline BOOST_CXX14_CONSTEXPR_IF_DETECTION boost::multiprecision::number, ExpressionTemplates> -get_max(const boost::mpl::true_&, const boost::mpl::false_&, const boost::mpl::true_&) +get_max(const std::integral_constant&, const std::integral_constant&, const std::integral_constant&) { // Bound and unsigned, no allocator so can be constexpr: typedef boost::multiprecision::number, ExpressionTemplates> result_type; @@ -133,7 +133,7 @@ get_max(const boost::mpl::true_&, const boost::mpl::false_&, const boost::mpl::t template inline boost::multiprecision::number, ExpressionTemplates> -get_max(const boost::mpl::true_&, const boost::mpl::false_&, const boost::mpl::false_&) +get_max(const std::integral_constant&, const std::integral_constant&, const std::integral_constant&) { // Bound and unsigned, has an allocator so can never be constexpr: typedef boost::multiprecision::number, ExpressionTemplates> result_type; @@ -144,7 +144,7 @@ get_max(const boost::mpl::true_&, const boost::mpl::false_&, const boost::mpl::f template inline boost::multiprecision::number, ExpressionTemplates> -get_max(const boost::mpl::false_&, const boost::mpl::true_&, const boost::mpl::bool_&) +get_max(const std::integral_constant&, const std::integral_constant&, const std::integral_constant&) { // Unbounded and signed. // There is no maximum value, just return 0: @@ -154,7 +154,7 @@ get_max(const boost::mpl::false_&, const boost::mpl::true_&, const boost::mpl::b template inline boost::multiprecision::number, ExpressionTemplates> -get_max(const boost::mpl::false_&, const boost::mpl::false_&, const boost::mpl::bool_&) +get_max(const std::integral_constant&, const std::integral_constant&, const std::integral_constant&) { // Unbound and unsigned: static const boost::multiprecision::number, ExpressionTemplates> val(0u); @@ -190,12 +190,12 @@ class numeric_limits(boost::multiprecision::backends::is_fixed_precision(), boost::multiprecision::is_signed_number(), boost::mpl::bool_::value>()); + return detail::get_min(boost::multiprecision::backends::is_fixed_precision(), boost::multiprecision::is_signed_number(), std::integral_constant::value>()); } static BOOST_CXX14_CONSTEXPR_IF_DETECTION number_type(max)() { init.do_nothing(); - return detail::get_max(boost::multiprecision::backends::is_fixed_precision(), boost::multiprecision::is_signed_number(), boost::mpl::bool_::value>()); + return detail::get_max(boost::multiprecision::backends::is_fixed_precision(), boost::multiprecision::is_signed_number(), std::integral_constant::value>()); } static BOOST_CXX14_CONSTEXPR_IF_DETECTION number_type lowest() { return (min)(); } static constexpr int digits = boost::multiprecision::backends::max_precision::value == UINT_MAX ? INT_MAX : boost::multiprecision::backends::max_precision::value; diff --git a/include/boost/multiprecision/cpp_int/misc.hpp b/include/boost/multiprecision/cpp_int/misc.hpp index 04b31023..ca5c9fcf 100644 --- a/include/boost/multiprecision/cpp_int/misc.hpp +++ b/include/boost/multiprecision/cpp_int/misc.hpp @@ -38,7 +38,7 @@ struct numeric_limits_workaround }; template -BOOST_MP_CXX14_CONSTEXPR void check_in_range(const CppInt& val, const mpl::int_&) +BOOST_MP_CXX14_CONSTEXPR void check_in_range(const CppInt& val, const std::integral_constant&) { typedef typename boost::multiprecision::detail::canonical::type cast_type; @@ -56,7 +56,7 @@ BOOST_MP_CXX14_CONSTEXPR void check_in_range(const CppInt& val, const mpl::int_< } } template -inline BOOST_MP_CXX14_CONSTEXPR void check_in_range(const CppInt& /*val*/, const mpl::int_&) BOOST_NOEXCEPT {} +inline BOOST_MP_CXX14_CONSTEXPR void check_in_range(const CppInt& /*val*/, const std::integral_constant&) BOOST_NOEXCEPT {} inline BOOST_MP_CXX14_CONSTEXPR void check_is_negative(const std::integral_constant&) BOOST_NOEXCEPT {} inline void check_is_negative(const std::integral_constant&) @@ -79,7 +79,7 @@ template ::value && !is_trivial_cpp_int >::value, void>::type eval_convert_to(R* result, const cpp_int_backend& backend) { - typedef mpl::int_ checked_type; + typedef std::integral_constant checked_type; check_in_range(backend, checked_type()); BOOST_IF_CONSTEXPR(numeric_limits_workaround::digits < cpp_int_backend::limb_bits) @@ -1111,11 +1111,11 @@ eval_lcm(cpp_int_backend& r result.normalize(); // result may overflow the specified number of bits } -inline void conversion_overflow(const mpl::int_&) +inline void conversion_overflow(const std::integral_constant&) { BOOST_THROW_EXCEPTION(std::overflow_error("Overflow in conversion to narrower type")); } -inline BOOST_MP_CXX14_CONSTEXPR void conversion_overflow(const mpl::int_&) {} +inline BOOST_MP_CXX14_CONSTEXPR void conversion_overflow(const std::integral_constant&) {} template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if< diff --git a/include/boost/multiprecision/cpp_int/serialize.hpp b/include/boost/multiprecision/cpp_int/serialize.hpp index bd32108b..c1ef57a9 100644 --- a/include/boost/multiprecision/cpp_int/serialize.hpp +++ b/include/boost/multiprecision/cpp_int/serialize.hpp @@ -25,13 +25,13 @@ using namespace boost::multiprecision; using namespace boost::multiprecision::backends; template -struct is_binary_archive : public mpl::false_ +struct is_binary_archive : public std::integral_constant {}; template <> -struct is_binary_archive : public mpl::true_ +struct is_binary_archive : public std::integral_constant {}; template <> -struct is_binary_archive : public mpl::true_ +struct is_binary_archive : public std::integral_constant {}; // @@ -41,7 +41,7 @@ struct is_binary_archive : public mpl::true_ // Binary or not archive. // template -void do_serialize(Archive& ar, Int& val, mpl::false_ const&, mpl::false_ const&, mpl::false_ const&) +void do_serialize(Archive& ar, Int& val, std::integral_constant const&, std::integral_constant const&, std::integral_constant const&) { // Load. // Non-trivial. @@ -72,7 +72,7 @@ void do_serialize(Archive& ar, Int& val, mpl::false_ const&, mpl::false_ const&, val.normalize(); } template -void do_serialize(Archive& ar, Int& val, mpl::true_ const&, mpl::false_ const&, mpl::false_ const&) +void do_serialize(Archive& ar, Int& val, std::integral_constant const&, std::integral_constant const&, std::integral_constant const&) { // Store. // Non-trivial. @@ -97,7 +97,7 @@ void do_serialize(Archive& ar, Int& val, mpl::true_ const&, mpl::false_ const&, } } template -void do_serialize(Archive& ar, Int& val, mpl::false_ const&, mpl::true_ const&, mpl::false_ const&) +void do_serialize(Archive& ar, Int& val, std::integral_constant const&, std::integral_constant const&, std::integral_constant const&) { // Load. // Trivial. @@ -119,7 +119,7 @@ void do_serialize(Archive& ar, Int& val, mpl::false_ const&, mpl::true_ const&, val.negate(); } template -void do_serialize(Archive& ar, Int& val, mpl::true_ const&, mpl::true_ const&, mpl::false_ const&) +void do_serialize(Archive& ar, Int& val, std::integral_constant const&, std::integral_constant const&, std::integral_constant const&) { // Store. // Trivial. @@ -137,7 +137,7 @@ void do_serialize(Archive& ar, Int& val, mpl::true_ const&, mpl::true_ const&, m } } template -void do_serialize(Archive& ar, Int& val, mpl::false_ const&, mpl::false_ const&, mpl::true_ const&) +void do_serialize(Archive& ar, Int& val, std::integral_constant const&, std::integral_constant const&, std::integral_constant const&) { // Load. // Non-trivial. @@ -153,7 +153,7 @@ void do_serialize(Archive& ar, Int& val, mpl::false_ const&, mpl::false_ const&, val.normalize(); } template -void do_serialize(Archive& ar, Int& val, mpl::true_ const&, mpl::false_ const&, mpl::true_ const&) +void do_serialize(Archive& ar, Int& val, std::integral_constant const&, std::integral_constant const&, std::integral_constant const&) { // Store. // Non-trivial. @@ -165,7 +165,7 @@ void do_serialize(Archive& ar, Int& val, mpl::true_ const&, mpl::false_ const&, ar.save_binary(val.limbs(), c * sizeof(limb_type)); } template -void do_serialize(Archive& ar, Int& val, mpl::false_ const&, mpl::true_ const&, mpl::true_ const&) +void do_serialize(Archive& ar, Int& val, std::integral_constant const&, std::integral_constant const&, std::integral_constant const&) { // Load. // Trivial. @@ -177,7 +177,7 @@ void do_serialize(Archive& ar, Int& val, mpl::false_ const&, mpl::true_ const&, val.negate(); } template -void do_serialize(Archive& ar, Int& val, mpl::true_ const&, mpl::true_ const&, mpl::true_ const&) +void do_serialize(Archive& ar, Int& val, std::integral_constant const&, std::integral_constant const&, std::integral_constant const&) { // Store. // Trivial. @@ -192,9 +192,10 @@ void do_serialize(Archive& ar, Int& val, mpl::true_ const&, mpl::true_ const&, m template void serialize(Archive& ar, mp::cpp_int_backend& val, const unsigned int /*version*/) { - typedef typename Archive::is_saving save_tag; - typedef mpl::bool_ >::value> trivial_tag; - typedef typename cpp_int_detail::is_binary_archive::type binary_tag; + typedef typename Archive::is_saving archive_save_tag; + typedef std::integral_constant save_tag; + typedef std::integral_constant >::value> trivial_tag; + typedef typename cpp_int_detail::is_binary_archive::type binary_tag; // Just dispatch to the correct method: cpp_int_detail::do_serialize(ar, val, save_tag(), trivial_tag(), binary_tag()); diff --git a/include/boost/multiprecision/detail/bitscan.hpp b/include/boost/multiprecision/detail/bitscan.hpp index 7a9f1e8f..2abd4e09 100644 --- a/include/boost/multiprecision/detail/bitscan.hpp +++ b/include/boost/multiprecision/detail/bitscan.hpp @@ -42,13 +42,13 @@ inline BOOST_MP_CXX14_CONSTEXPR unsigned find_msb_default(Unsigned mask) } template -inline BOOST_MP_CXX14_CONSTEXPR unsigned find_lsb(Unsigned mask, const mpl::int_<0>&) +inline BOOST_MP_CXX14_CONSTEXPR unsigned find_lsb(Unsigned mask, const std::integral_constant&) { return find_lsb_default(mask); } template -inline BOOST_MP_CXX14_CONSTEXPR unsigned find_msb(Unsigned mask, const mpl::int_<0>&) +inline BOOST_MP_CXX14_CONSTEXPR unsigned find_msb(Unsigned mask, const std::integral_constant&) { return find_msb_default(mask); } @@ -57,14 +57,14 @@ inline BOOST_MP_CXX14_CONSTEXPR unsigned find_msb(Unsigned mask, const mpl::int_ #pragma intrinsic(_BitScanForward, _BitScanReverse) -BOOST_FORCEINLINE unsigned find_lsb(unsigned long mask, const mpl::int_<1>&) +BOOST_FORCEINLINE unsigned find_lsb(unsigned long mask, const std::integral_constant&) { unsigned long result; _BitScanForward(&result, mask); return result; } -BOOST_FORCEINLINE unsigned find_msb(unsigned long mask, const mpl::int_<1>&) +BOOST_FORCEINLINE unsigned find_msb(unsigned long mask, const std::integral_constant&) { unsigned long result; _BitScanReverse(&result, mask); @@ -74,14 +74,14 @@ BOOST_FORCEINLINE unsigned find_msb(unsigned long mask, const mpl::int_<1>&) #pragma intrinsic(_BitScanForward64, _BitScanReverse64) -BOOST_FORCEINLINE unsigned find_lsb(unsigned __int64 mask, const mpl::int_<2>&) +BOOST_FORCEINLINE unsigned find_lsb(unsigned __int64 mask, const std::integral_constant&) { unsigned long result; _BitScanForward64(&result, mask); return result; } template -BOOST_FORCEINLINE unsigned find_msb(Unsigned mask, const mpl::int_<2>&) +BOOST_FORCEINLINE unsigned find_msb(Unsigned mask, const std::integral_constant&) { unsigned long result; _BitScanReverse64(&result, mask); @@ -95,14 +95,14 @@ BOOST_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR unsigned find_lsb(Unsigned mask) typedef typename boost::multiprecision::detail::make_unsigned::type ui_type; typedef typename std::conditional< sizeof(Unsigned) <= sizeof(unsigned long), - mpl::int_<1>, + std::integral_constant, #ifdef _M_X64 typename std::conditional< sizeof(Unsigned) <= sizeof(__int64), - mpl::int_<2>, - mpl::int_<0> >::type + std::integral_constant, + std::integral_constant >::type #else - mpl::int_<0> + std::integral_constant #endif >::type tag_type; #ifndef BOOST_MP_NO_CONSTEXPR_DETECTION @@ -121,14 +121,14 @@ BOOST_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR unsigned find_msb(Unsigned mask) typedef typename boost::multiprecision::detail::make_unsigned::type ui_type; typedef typename std::conditional< sizeof(Unsigned) <= sizeof(unsigned long), - mpl::int_<1>, + std::integral_constant, #ifdef _M_X64 typename std::conditional< sizeof(Unsigned) <= sizeof(__int64), - mpl::int_<2>, - mpl::int_<0> >::type + std::integral_constant, + std::integral_constant >::type #else - mpl::int_<0> + std::integral_constant #endif >::type tag_type; #ifndef BOOST_MP_NO_CONSTEXPR_DETECTION @@ -143,27 +143,27 @@ BOOST_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR unsigned find_msb(Unsigned mask) #elif defined(BOOST_GCC) || defined(__clang__) || (defined(BOOST_INTEL) && defined(__GNUC__)) -BOOST_FORCEINLINE unsigned find_lsb(unsigned mask, mpl::int_<1> const&) +BOOST_FORCEINLINE unsigned find_lsb(unsigned mask, std::integral_constant const&) { return __builtin_ctz(mask); } -BOOST_FORCEINLINE unsigned find_lsb(unsigned long mask, mpl::int_<2> const&) +BOOST_FORCEINLINE unsigned find_lsb(unsigned long mask, std::integral_constant const&) { return __builtin_ctzl(mask); } -BOOST_FORCEINLINE unsigned find_lsb(boost::ulong_long_type mask, mpl::int_<3> const&) +BOOST_FORCEINLINE unsigned find_lsb(boost::ulong_long_type mask, std::integral_constant const&) { return __builtin_ctzll(mask); } -BOOST_FORCEINLINE unsigned find_msb(unsigned mask, mpl::int_<1> const&) +BOOST_FORCEINLINE unsigned find_msb(unsigned mask, std::integral_constant const&) { return sizeof(unsigned) * CHAR_BIT - 1 - __builtin_clz(mask); } -BOOST_FORCEINLINE unsigned find_msb(unsigned long mask, mpl::int_<2> const&) +BOOST_FORCEINLINE unsigned find_msb(unsigned long mask, std::integral_constant const&) { return sizeof(unsigned long) * CHAR_BIT - 1 - __builtin_clzl(mask); } -BOOST_FORCEINLINE unsigned find_msb(boost::ulong_long_type mask, mpl::int_<3> const&) +BOOST_FORCEINLINE unsigned find_msb(boost::ulong_long_type mask, std::integral_constant const&) { return sizeof(boost::ulong_long_type) * CHAR_BIT - 1 - __builtin_clzll(mask); } @@ -171,7 +171,7 @@ BOOST_FORCEINLINE unsigned find_msb(boost::ulong_long_type mask, mpl::int_<3> co __extension__ typedef unsigned __int128 uint128_type; -BOOST_FORCEINLINE unsigned find_msb(uint128_type mask, mpl::int_<0> const&) +BOOST_FORCEINLINE unsigned find_msb(uint128_type mask, std::integral_constant const&) { union { @@ -181,15 +181,15 @@ BOOST_FORCEINLINE unsigned find_msb(uint128_type mask, mpl::int_<0> const&) val.v = mask; #if BOOST_ENDIAN_LITTLE_BYTE if (val.sv[1]) - return find_msb(val.sv[1], mpl::int_<3>()) + 64; - return find_msb(val.sv[0], mpl::int_<3>()); + return find_msb(val.sv[1], std::integral_constant()) + 64; + return find_msb(val.sv[0], std::integral_constant()); #else if (val.sv[0]) - return find_msb(val.sv[0], mpl::int_<3>()) + 64; - return find_msb(val.sv[1], mpl::int_<3>()); + return find_msb(val.sv[0], std::integral_constant()) + 64; + return find_msb(val.sv[1], std::integral_constant()); #endif } -BOOST_FORCEINLINE unsigned find_lsb(uint128_type mask, mpl::int_<0> const&) +BOOST_FORCEINLINE unsigned find_lsb(uint128_type mask, std::integral_constant const&) { union { @@ -199,12 +199,12 @@ BOOST_FORCEINLINE unsigned find_lsb(uint128_type mask, mpl::int_<0> const&) val.v = mask; #if BOOST_ENDIAN_LITTLE_BYTE if (val.sv[0] == 0) - return find_lsb(val.sv[1], mpl::int_<3>()) + 64; - return find_lsb(val.sv[0], mpl::int_<3>()); + return find_lsb(val.sv[1], std::integral_constant()) + 64; + return find_lsb(val.sv[0], std::integral_constant()); #else if (val.sv[1] == 0) - return find_lsb(val.sv[0], mpl::int_<3>()) + 64; - return find_lsb(val.sv[1], mpl::int_<3>()); + return find_lsb(val.sv[0], std::integral_constant()) + 64; + return find_lsb(val.sv[1], std::integral_constant()); #endif } #endif @@ -215,14 +215,14 @@ BOOST_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR unsigned find_lsb(Unsigned mask) typedef typename boost::multiprecision::detail::make_unsigned::type ui_type; typedef typename std::conditional< sizeof(Unsigned) <= sizeof(unsigned), - mpl::int_<1>, + std::integral_constant, typename std::conditional< sizeof(Unsigned) <= sizeof(unsigned long), - mpl::int_<2>, + std::integral_constant, typename std::conditional< sizeof(Unsigned) <= sizeof(boost::ulong_long_type), - mpl::int_<3>, - mpl::int_<0> >::type>::type>::type tag_type; + std::integral_constant, + std::integral_constant >::type>::type>::type tag_type; #ifndef BOOST_MP_NO_CONSTEXPR_DETECTION if (BOOST_MP_IS_CONST_EVALUATED(mask)) { @@ -238,14 +238,14 @@ BOOST_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR unsigned find_msb(Unsigned mask) typedef typename boost::multiprecision::detail::make_unsigned::type ui_type; typedef typename std::conditional< sizeof(Unsigned) <= sizeof(unsigned), - mpl::int_<1>, + std::integral_constant, typename std::conditional< sizeof(Unsigned) <= sizeof(unsigned long), - mpl::int_<2>, + std::integral_constant, typename std::conditional< sizeof(Unsigned) <= sizeof(boost::ulong_long_type), - mpl::int_<3>, - mpl::int_<0> >::type>::type>::type tag_type; + std::integral_constant, + std::integral_constant >::type>::type>::type tag_type; #ifndef BOOST_MP_NO_CONSTEXPR_DETECTION if (BOOST_MP_IS_CONST_EVALUATED(mask)) { @@ -256,11 +256,11 @@ BOOST_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR unsigned find_msb(Unsigned mask) return find_msb(static_cast(mask), tag_type()); } #elif defined(BOOST_INTEL) -BOOST_FORCEINLINE unsigned find_lsb(unsigned mask, mpl::int_<1> const&) +BOOST_FORCEINLINE unsigned find_lsb(unsigned mask, std::integral_constant const&) { return _bit_scan_forward(mask); } -BOOST_FORCEINLINE unsigned find_msb(unsigned mask, mpl::int_<1> const&) +BOOST_FORCEINLINE unsigned find_msb(unsigned mask, std::integral_constant const&) { return _bit_scan_reverse(mask); } @@ -270,8 +270,8 @@ BOOST_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR unsigned find_lsb(Unsigned mask) typedef typename boost::multiprecision::detail::make_unsigned::type ui_type; typedef typename std::conditional< sizeof(Unsigned) <= sizeof(unsigned), - mpl::int_<1>, - mpl::int_<0> >::type tag_type; + std::integral_constant, + std::integral_constant >::type tag_type; #ifndef BOOST_MP_NO_CONSTEXPR_DETECTION if (BOOST_MP_IS_CONST_EVALUATED(mask)) { @@ -287,8 +287,8 @@ BOOST_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR unsigned find_msb(Unsigned mask) typedef typename boost::multiprecision::detail::make_unsigned::type ui_type; typedef typename std::conditional< sizeof(Unsigned) <= sizeof(unsigned), - mpl::int_<1>, - mpl::int_<0> >::type tag_type; + std::integral_constant, + std::integral_constant >::type tag_type; #ifndef BOOST_MP_NO_CONSTEXPR_DETECTION if (BOOST_MP_IS_CONST_EVALUATED(mask)) { @@ -302,12 +302,12 @@ BOOST_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR unsigned find_msb(Unsigned mask) template BOOST_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR unsigned find_lsb(Unsigned mask) { - return find_lsb(mask, mpl::int_<0>()); + return find_lsb(mask, std::integral_constant()); } template BOOST_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR unsigned find_msb(Unsigned mask) { - return find_msb(mask, mpl::int_<0>()); + return find_msb(mask, std::integral_constant()); } #endif diff --git a/include/boost/multiprecision/detail/default_ops.hpp b/include/boost/multiprecision/detail/default_ops.hpp index 3296007d..407e23ea 100644 --- a/include/boost/multiprecision/detail/default_ops.hpp +++ b/include/boost/multiprecision/detail/default_ops.hpp @@ -12,8 +12,6 @@ #include #include #include -#include -#include #include #ifndef BOOST_NO_CXX17_HDR_STRING_VIEW #include @@ -37,15 +35,15 @@ template struct is_backend; template -void generic_interconvert(To& to, const From& from, const mpl::int_& /*to_type*/, const mpl::int_& /*from_type*/); +void generic_interconvert(To& to, const From& from, const std::integral_constant& /*to_type*/, const std::integral_constant& /*from_type*/); template -void generic_interconvert(To& to, const From& from, const mpl::int_& /*to_type*/, const mpl::int_& /*from_type*/); +void generic_interconvert(To& to, const From& from, const std::integral_constant& /*to_type*/, const std::integral_constant& /*from_type*/); template -void generic_interconvert(To& to, const From& from, const mpl::int_& /*to_type*/, const mpl::int_& /*from_type*/); +void generic_interconvert(To& to, const From& from, const std::integral_constant& /*to_type*/, const std::integral_constant& /*from_type*/); template -void generic_interconvert(To& to, const From& from, const mpl::int_& /*to_type*/, const mpl::int_& /*from_type*/); +void generic_interconvert(To& to, const From& from, const std::integral_constant& /*to_type*/, const std::integral_constant& /*from_type*/); template -void generic_interconvert(To& to, const From& from, const mpl::int_& /*to_type*/, const mpl::int_& /*from_type*/); +void generic_interconvert(To& to, const From& from, const std::integral_constant& /*to_type*/, const std::integral_constant& /*from_type*/); } // namespace detail @@ -786,13 +784,13 @@ inline BOOST_MP_CXX14_CONSTEXPR void eval_bitwise_xor(T& t, const U& u, const V& template inline BOOST_MP_CXX14_CONSTEXPR void eval_increment(T& val) { - typedef typename mpl::front::type ui_type; + typedef typename std::tuple_element<0, typename T::unsigned_types>::type ui_type; eval_add(val, static_cast(1u)); } template inline BOOST_MP_CXX14_CONSTEXPR void eval_decrement(T& val) { - typedef typename mpl::front::type ui_type; + typedef typename std::tuple_element<0, typename T::unsigned_types>::type ui_type; eval_subtract(val, static_cast(1u)); } @@ -813,18 +811,18 @@ inline BOOST_MP_CXX14_CONSTEXPR void eval_right_shift(T& result, const U& arg, c template inline BOOST_MP_CXX14_CONSTEXPR bool eval_is_zero(const T& val) { - typedef typename mpl::front::type ui_type; + typedef typename std::tuple_element<0, typename T::unsigned_types>::type ui_type; return val.compare(static_cast(0)) == 0; } template inline BOOST_MP_CXX14_CONSTEXPR int eval_get_sign(const T& val) { - typedef typename mpl::front::type ui_type; + typedef typename std::tuple_element<0, typename T::unsigned_types>::type ui_type; return val.compare(static_cast(0)); } template -inline BOOST_MP_CXX14_CONSTEXPR void assign_components_imp(T& result, const V& v1, const U& v2, const mpl::int_&) +inline BOOST_MP_CXX14_CONSTEXPR void assign_components_imp(T& result, const V& v1, const U& v2, const std::integral_constant&) { result = v1; T t; @@ -833,7 +831,7 @@ inline BOOST_MP_CXX14_CONSTEXPR void assign_components_imp(T& result, const V& v } template -inline BOOST_MP_CXX14_CONSTEXPR void assign_components_imp(T& result, const V& v1, const U& v2, const mpl::int_&) +inline BOOST_MP_CXX14_CONSTEXPR void assign_components_imp(T& result, const V& v1, const U& v2, const std::integral_constant&) { typedef typename component_type >::type component_number_type; @@ -868,7 +866,7 @@ template struct has_enough_bits { template - struct type : public mpl::bool_::value && (std::numeric_limits::digits >= b)> + struct type : public std::integral_constant::value && (std::numeric_limits::digits >= b)> {}; }; @@ -886,6 +884,18 @@ struct terminal BOOST_MP_CXX14_CONSTEXPR operator R() const { return value; } }; +template ::value)> +struct find_index_of_type +{ + static constexpr int value = std::is_same::type>::value ? i : find_index_of_type::value; +}; +template +struct find_index_of_type +{ + static constexpr int value = -1; +}; + + template struct calculate_next_larger_type { @@ -897,25 +907,9 @@ struct calculate_next_larger_type boost::multiprecision::detail::is_unsigned::value, typename B::unsigned_types, typename B::float_types>::type>::type list_type; - // A predicate to find a type with enough bits: - typedef typename has_enough_bits::digits>::template type pred_type; - // See if the last type is in the list, if so we have to start after this: - typedef typename mpl::find_if< - list_type, - std::is_same >::type start_last; - // Where we're starting from, either the start of the sequence or the last type found: - typedef typename std::conditional::type>::value, typename mpl::begin::type, start_last>::type start_seq; - // The range we're searching: - typedef mpl::iterator_range::type> range; - // Find the next type: - typedef typename mpl::find_if< - range, - pred_type>::type iter_type; - // Either the next type, or a "terminal" to indicate we've run out of types to search: - typedef typename mpl::eval_if_c< - std::is_same::type, iter_type>::value, - mpl::identity >, - mpl::deref >::type type; + static constexpr int start = find_index_of_type::value; + static constexpr int index_of_type = boost::multiprecision::detail::find_index_of_large_enough_type::digits>::value; + typedef typename boost::multiprecision::detail::dereference_tuple >::type type; }; template @@ -961,7 +955,7 @@ inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if< !boost::multiprecision: } template -inline void last_chance_eval_convert_to(terminal* result, const B& backend, const mpl::false_&) +inline void last_chance_eval_convert_to(terminal* result, const B& backend, const std::integral_constant&) { // // We ran out of types to try for the conversion, try @@ -985,7 +979,7 @@ inline void last_chance_eval_convert_to(terminal* result, const B& backend, c } template -inline void last_chance_eval_convert_to(terminal* result, const B& backend, const mpl::true_&) +inline void last_chance_eval_convert_to(terminal* result, const B& backend, const std::integral_constant&) { // // We ran out of types to try for the conversion, try @@ -1014,7 +1008,7 @@ inline void last_chance_eval_convert_to(terminal* result, const B& backend, c template inline BOOST_MP_CXX14_CONSTEXPR void eval_convert_to(terminal* result, const B& backend) { - typedef mpl::bool_::value && number_category::value == number_kind_integer> tag_type; + typedef std::integral_constant::value && number_category::value == number_kind_integer> tag_type; last_chance_eval_convert_to(result, backend, tag_type()); } @@ -1074,7 +1068,7 @@ template inline BOOST_MP_CXX14_CONSTEXPR void eval_abs(T& result, const U& arg) { typedef typename U::signed_types type_list; - typedef typename mpl::front::type front; + typedef typename std::tuple_element<0, type_list>::type front; result = arg; if (arg.compare(front(0)) < 0) result.negate(); @@ -1084,7 +1078,7 @@ inline BOOST_MP_CXX14_CONSTEXPR void eval_fabs(T& result, const U& arg) { static_assert(number_category::value == number_kind_floating_point, "The fabs function is only valid for floating point types."); typedef typename U::signed_types type_list; - typedef typename mpl::front::type front; + typedef typename std::tuple_element<0, type_list>::type front; result = arg; if (arg.compare(front(0)) < 0) result.negate(); @@ -1811,7 +1805,7 @@ inline BOOST_MP_CXX14_CONSTEXPR void eval_real(To& to, const From& from) template inline BOOST_MP_CXX14_CONSTEXPR void eval_imag(To& to, const From&) { - typedef typename mpl::front::type ui_type; + typedef typename std::tuple_element<0, typename To::unsigned_types>::type ui_type; to = ui_type(0); } diff --git a/include/boost/multiprecision/detail/float_string_cvt.hpp b/include/boost/multiprecision/detail/float_string_cvt.hpp index 98d8d26e..3e4f5448 100644 --- a/include/boost/multiprecision/detail/float_string_cvt.hpp +++ b/include/boost/multiprecision/detail/float_string_cvt.hpp @@ -53,7 +53,7 @@ std::string convert_to_string(Backend b, std::streamsize digits, std::ios_base:: using default_ops::eval_pow; using default_ops::eval_subtract; - typedef typename mpl::front::type ui_type; + typedef typename std::tuple_element<0, typename Backend::unsigned_types>::type ui_type; typedef typename Backend::exponent_type exponent_type; std::string result; @@ -196,7 +196,7 @@ void convert_from_string(Backend& b, const char* p) using default_ops::eval_multiply; using default_ops::eval_pow; - typedef typename mpl::front::type ui_type; + typedef typename std::tuple_element<0, typename Backend::unsigned_types>::type ui_type; b = ui_type(0); if (!p || (*p == 0)) return; diff --git a/include/boost/multiprecision/detail/functions/constants.hpp b/include/boost/multiprecision/detail/functions/constants.hpp index d167ceb9..9dc1ca03 100644 --- a/include/boost/multiprecision/detail/functions/constants.hpp +++ b/include/boost/multiprecision/detail/functions/constants.hpp @@ -10,7 +10,7 @@ template void calc_log2(T& num, unsigned digits) { typedef typename boost::multiprecision::detail::canonical::type ui_type; - typedef typename mpl::front::type si_type; + typedef typename std::tuple_element<0, typename T::signed_types>::type si_type; // // String value with 1100 digits: @@ -80,7 +80,7 @@ void calc_log2(T& num, unsigned digits) template void calc_e(T& result, unsigned digits) { - typedef typename mpl::front::type ui_type; + typedef typename std::tuple_element<0, typename T::unsigned_types>::type ui_type; // // 1100 digits in string form: // @@ -129,8 +129,8 @@ void calc_e(T& result, unsigned digits) template void calc_pi(T& result, unsigned digits) { - typedef typename mpl::front::type ui_type; - typedef typename mpl::front::type real_type; + typedef typename std::tuple_element<0, typename T::unsigned_types>::type ui_type; + typedef typename std::tuple_element<0, typename T::float_types>::type real_type; // // 1100 digits in string form: // @@ -327,7 +327,7 @@ const T& get_constant_one_over_epsilon() if ((digits != boost::multiprecision::detail::digits2 >::value())) { #endif - typedef typename mpl::front::type ui_type; + typedef typename std::tuple_element<0, typename T::unsigned_types>::type ui_type; boost::multiprecision::detail::maybe_promote_precision(&result); result = static_cast(1u); if(std::numeric_limits >::is_specialized) diff --git a/include/boost/multiprecision/detail/functions/pow.hpp b/include/boost/multiprecision/detail/functions/pow.hpp index 11ca0895..c2c53ccd 100644 --- a/include/boost/multiprecision/detail/functions/pow.hpp +++ b/include/boost/multiprecision/detail/functions/pow.hpp @@ -102,7 +102,7 @@ void hyp0F0(T& H0F0, const T& x) // http://functions.wolfram.com/HypergeometricFunctions/Hypergeometric0F0/06/01/ // There are no checks on input range or parameter boundaries. - typedef typename mpl::front::type ui_type; + typedef typename std::tuple_element<0, typename T::unsigned_types>::type ui_type; BOOST_ASSERT(&H0F0 != &x); long tol = boost::multiprecision::detail::digits2 >::value(); @@ -350,7 +350,7 @@ void eval_log(T& result, const T& arg) typedef typename boost::multiprecision::detail::canonical::type ui_type; typedef typename T::exponent_type exp_type; typedef typename boost::multiprecision::detail::canonical::type canonical_exp_type; - typedef typename mpl::front::type fp_type; + typedef typename std::tuple_element<0, typename T::float_types>::type fp_type; int s = eval_signbit(arg); switch (eval_fpclassify(arg)) { @@ -471,7 +471,7 @@ inline void eval_pow(T& result, const T& x, const T& a) { static_assert(number_category::value == number_kind_floating_point, "The pow function is only valid for floating point types."); typedef typename boost::multiprecision::detail::canonical::type si_type; - typedef typename mpl::front::type fp_type; + typedef typename std::tuple_element<0, typename T::float_types>::type fp_type; if ((&result == &x) || (&result == &a)) { @@ -761,7 +761,7 @@ void eval_exp2(T& result, const T& arg) eval_convert_to(&i, temp); if (arg.compare(i) == 0) { - temp = static_cast::type>(1u); + temp = static_cast::type>(1u); eval_ldexp(result, temp, i); return; } @@ -774,7 +774,7 @@ void eval_exp2(T& result, const T& arg) } BOOST_CATCH_END - temp = static_cast::type>(2u); + temp = static_cast::type>(2u); eval_pow(result, temp, arg); } @@ -811,7 +811,7 @@ template void sinhcosh(const T& x, T* p_sinh, T* p_cosh) { typedef typename boost::multiprecision::detail::canonical::type ui_type; - typedef typename mpl::front::type fp_type; + typedef typename std::tuple_element<0, typename T::float_types>::type fp_type; switch (eval_fpclassify(x)) { @@ -896,7 +896,7 @@ inline void eval_tanh(T& result, const T& x) if ((eval_fpclassify(result) == FP_INFINITE) && (eval_fpclassify(c) == FP_INFINITE)) { bool s = eval_signbit(result) != eval_signbit(c); - result = static_cast::type>(1u); + result = static_cast::type>(1u); if (s) result.negate(); return; diff --git a/include/boost/multiprecision/detail/functions/trig.hpp b/include/boost/multiprecision/detail/functions/trig.hpp index b9aa4d7f..fba1f3aa 100644 --- a/include/boost/multiprecision/detail/functions/trig.hpp +++ b/include/boost/multiprecision/detail/functions/trig.hpp @@ -164,7 +164,7 @@ void eval_sin(T& result, const T& x) typedef typename boost::multiprecision::detail::canonical::type si_type; typedef typename boost::multiprecision::detail::canonical::type ui_type; - typedef typename mpl::front::type fp_type; + typedef typename std::tuple_element<0, typename T::float_types>::type fp_type; switch (eval_fpclassify(x)) { @@ -563,7 +563,7 @@ void eval_asin(T& result, const T& x) { static_assert(number_category::value == number_kind_floating_point, "The asin function is only valid for floating point types."); typedef typename boost::multiprecision::detail::canonical::type ui_type; - typedef typename mpl::front::type fp_type; + typedef typename std::tuple_element<0, typename T::float_types>::type fp_type; if (&result == &x) { @@ -736,7 +736,7 @@ inline void eval_acos(T& result, const T& x) return; } - typedef typename mpl::front::type fp_type; + typedef typename std::tuple_element<0, typename T::float_types>::type fp_type; if (xx.compare(fp_type(1e-3)) < 0) { @@ -820,7 +820,7 @@ void eval_atan(T& result, const T& x) static_assert(number_category::value == number_kind_floating_point, "The atan function is only valid for floating point types."); typedef typename boost::multiprecision::detail::canonical::type si_type; typedef typename boost::multiprecision::detail::canonical::type ui_type; - typedef typename mpl::front::type fp_type; + typedef typename std::tuple_element<0, typename T::float_types>::type fp_type; switch (eval_fpclassify(x)) { diff --git a/include/boost/multiprecision/detail/generic_interconvert.hpp b/include/boost/multiprecision/detail/generic_interconvert.hpp index 604d26f3..f2fd0333 100644 --- a/include/boost/multiprecision/detail/generic_interconvert.hpp +++ b/include/boost/multiprecision/detail/generic_interconvert.hpp @@ -27,7 +27,7 @@ inline To do_cast(const number& from) } template -void generic_interconvert(To& to, const From& from, const mpl::int_& /*to_type*/, const mpl::int_& /*from_type*/) +void generic_interconvert(To& to, const From& from, const std::integral_constant& /*to_type*/, const std::integral_constant& /*from_type*/) { using default_ops::eval_add; using default_ops::eval_bitwise_and; @@ -75,7 +75,7 @@ void generic_interconvert(To& to, const From& from, const mpl::int_ -void generic_interconvert(To& to, const From& from, const mpl::int_& /*to_type*/, const mpl::int_& /*from_type*/) +void generic_interconvert(To& to, const From& from, const std::integral_constant& /*to_type*/, const std::integral_constant& /*from_type*/) { using default_ops::eval_bitwise_and; using default_ops::eval_bitwise_or; @@ -123,7 +123,7 @@ void generic_interconvert(To& to, const From& from, const mpl::int_ -void generic_interconvert(To& to, const From& from, const mpl::int_& /*to_type*/, const mpl::int_& /*from_type*/) +void generic_interconvert(To& to, const From& from, const std::integral_constant& /*to_type*/, const std::integral_constant& /*from_type*/) { #ifdef BOOST_MSVC #pragma warning(push) @@ -214,7 +214,7 @@ void generic_interconvert(To& to, const From& from, const mpl::int_ -void generic_interconvert(To& to, const From& from, const mpl::int_& /*to_type*/, const mpl::int_& /*from_type*/) +void generic_interconvert(To& to, const From& from, const std::integral_constant& /*to_type*/, const std::integral_constant& /*from_type*/) { typedef typename component_type >::type to_component_type; @@ -225,7 +225,7 @@ void generic_interconvert(To& to, const From& from, const mpl::int_ -void generic_interconvert(To& to, const From& from, const mpl::int_& /*to_type*/, const mpl::int_& /*from_type*/) +void generic_interconvert(To& to, const From& from, const std::integral_constant& /*to_type*/, const std::integral_constant& /*from_type*/) { typedef typename component_type >::type to_component_type; @@ -273,7 +273,7 @@ R safe_convert_to_float(const LargeInteger& i) template inline typename std::enable_if::value || std::is_floating_point::value)>::type -generic_convert_rational_to_float_imp(To& result, const Integer& n, const Integer& d, const mpl::true_&) +generic_convert_rational_to_float_imp(To& result, const Integer& n, const Integer& d, const std::integral_constant&) { // // If we get here, then there's something about one type or the other @@ -286,7 +286,7 @@ generic_convert_rational_to_float_imp(To& result, const Integer& n, const Intege } template inline typename std::enable_if::value || std::is_floating_point::value>::type -generic_convert_rational_to_float_imp(To& result, const Integer& n, const Integer& d, const mpl::true_&) +generic_convert_rational_to_float_imp(To& result, const Integer& n, const Integer& d, const std::integral_constant&) { // // If we get here, then there's something about one type or the other @@ -300,7 +300,7 @@ generic_convert_rational_to_float_imp(To& result, const Integer& n, const Intege template typename std::enable_if::value || std::is_floating_point::value>::type -generic_convert_rational_to_float_imp(To& result, Integer& num, Integer& denom, const mpl::false_&) +generic_convert_rational_to_float_imp(To& result, Integer& num, Integer& denom, const std::integral_constant&) { // // If we get here, then the precision of type To is known, and the integer type is unbounded @@ -361,7 +361,7 @@ generic_convert_rational_to_float_imp(To& result, Integer& num, Integer& denom, } template inline typename std::enable_if::value || std::is_floating_point::value)>::type -generic_convert_rational_to_float_imp(To& result, Integer& num, Integer& denom, const mpl::false_& tag) +generic_convert_rational_to_float_imp(To& result, Integer& num, Integer& denom, const std::integral_constant& tag) { number t; generic_convert_rational_to_float_imp(t, num, denom, tag); @@ -381,22 +381,22 @@ inline void generic_convert_rational_to_float(To& result, const From& f) typedef typename std::conditional::value, From, number >::type actual_from_type; typedef typename std::conditional::value || std::is_floating_point::value, To, number >::type actual_to_type; typedef typename component_type::type integer_type; - typedef mpl::bool_::is_specialized || std::numeric_limits::is_bounded || !std::numeric_limits::is_specialized || !std::numeric_limits::is_bounded || (std::numeric_limits::radix != 2)> dispatch_tag; + typedef std::integral_constant::is_specialized || std::numeric_limits::is_bounded || !std::numeric_limits::is_specialized || !std::numeric_limits::is_bounded || (std::numeric_limits::radix != 2)> dispatch_tag; integer_type n(numerator(static_cast(f))), d(denominator(static_cast(f))); generic_convert_rational_to_float_imp(result, n, d, dispatch_tag()); } template -inline void generic_interconvert(To& to, const From& from, const mpl::int_& /*to_type*/, const mpl::int_& /*from_type*/) +inline void generic_interconvert(To& to, const From& from, const std::integral_constant& /*to_type*/, const std::integral_constant& /*from_type*/) { generic_convert_rational_to_float(to, from); } template -void generic_interconvert_float2rational(To& to, const From& from, const mpl::int_<2>& /*radix*/) +void generic_interconvert_float2rational(To& to, const From& from, const std::integral_constant& /*radix*/) { - typedef typename mpl::front::type ui_type; + typedef typename std::tuple_element<0, typename To::unsigned_types>::type ui_type; static const int shift = std::numeric_limits::digits; typename From::exponent_type e; typename component_type >::type num, denom; @@ -420,14 +420,14 @@ void generic_interconvert_float2rational(To& to, const From& from, const mpl::in } template -void generic_interconvert_float2rational(To& to, const From& from, const mpl::int_& /*radix*/) +void generic_interconvert_float2rational(To& to, const From& from, const std::integral_constant& /*radix*/) { // // This is almost the same as the binary case above, but we have to use // scalbn and ilogb rather than ldexp and frexp, we also only extract // one Radix digit at a time which is terribly inefficient! // - typedef typename mpl::front::type ui_type; + typedef typename std::tuple_element<0, typename To::unsigned_types>::type ui_type; typename From::exponent_type e; typename component_type >::type num, denom; number val(from); @@ -461,13 +461,13 @@ void generic_interconvert_float2rational(To& to, const From& from, const mpl::in } template -void generic_interconvert(To& to, const From& from, const mpl::int_& /*to_type*/, const mpl::int_& /*from_type*/) +void generic_interconvert(To& to, const From& from, const std::integral_constant& /*to_type*/, const std::integral_constant& /*from_type*/) { - generic_interconvert_float2rational(to, from, mpl::int_ >::radix>()); + generic_interconvert_float2rational(to, from, std::integral_constant >::radix>()); } template -void generic_interconvert(To& to, const From& from, const mpl::int_& /*to_type*/, const mpl::int_& /*from_type*/) +void generic_interconvert(To& to, const From& from, const std::integral_constant& /*to_type*/, const std::integral_constant& /*from_type*/) { number t(from); number result(numerator(t) / denominator(t)); @@ -475,7 +475,7 @@ void generic_interconvert(To& to, const From& from, const mpl::int_ -void generic_interconvert_float2int(To& to, const From& from, const mpl::int_<2>& /*radix*/) +void generic_interconvert_float2int(To& to, const From& from, const std::integral_constant& /*radix*/) { typedef typename From::exponent_type exponent_type; static const exponent_type shift = std::numeric_limits::digits; @@ -505,7 +505,7 @@ void generic_interconvert_float2int(To& to, const From& from, const mpl::int_<2> } template -void generic_interconvert_float2int(To& to, const From& from, const mpl::int_& /*radix*/) +void generic_interconvert_float2int(To& to, const From& from, const std::integral_constant& /*radix*/) { // // This is almost the same as the binary case above, but we have to use @@ -530,13 +530,13 @@ void generic_interconvert_float2int(To& to, const From& from, const mpl::int_ -void generic_interconvert(To& to, const From& from, const mpl::int_& /*to_type*/, const mpl::int_& /*from_type*/) +void generic_interconvert(To& to, const From& from, const std::integral_constant& /*to_type*/, const std::integral_constant& /*from_type*/) { - generic_interconvert_float2int(to, from, mpl::int_ >::radix>()); + generic_interconvert_float2int(to, from, std::integral_constant >::radix>()); } template -void generic_interconvert_complex_to_scalar(To& to, const From& from, const mpl::true_&, const tag&) +void generic_interconvert_complex_to_scalar(To& to, const From& from, const std::integral_constant&, const tag&) { // We just want the real part, and "to" is the correct type already: eval_real(to, from); @@ -547,7 +547,7 @@ void generic_interconvert_complex_to_scalar(To& to, const From& from, const mpl: BOOST_THROW_EXCEPTION(std::runtime_error("Could not convert imaginary number to scalar.")); } template -void generic_interconvert_complex_to_scalar(To& to, const From& from, const mpl::false_&, const mpl::true_&) +void generic_interconvert_complex_to_scalar(To& to, const From& from, const std::integral_constant&, const std::integral_constant&) { typedef typename component_type >::type component_number; typedef typename component_number::backend_type component_backend; @@ -555,11 +555,11 @@ void generic_interconvert_complex_to_scalar(To& to, const From& from, const mpl: // Get the real part and copy-construct the result from it: // component_backend r; - generic_interconvert_complex_to_scalar(r, from, mpl::true_(), mpl::true_()); + generic_interconvert_complex_to_scalar(r, from, std::integral_constant(), std::integral_constant()); to = r; } template -void generic_interconvert_complex_to_scalar(To& to, const From& from, const mpl::false_&, const mpl::false_&) +void generic_interconvert_complex_to_scalar(To& to, const From& from, const std::integral_constant&, const std::integral_constant&) { typedef typename component_type >::type component_number; typedef typename component_number::backend_type component_backend; @@ -567,25 +567,25 @@ void generic_interconvert_complex_to_scalar(To& to, const From& from, const mpl: // Get the real part and use a generic_interconvert to type To: // component_backend r; - generic_interconvert_complex_to_scalar(r, from, mpl::true_(), mpl::true_()); - generic_interconvert(to, r, mpl::int_::value>(), mpl::int_::value>()); + generic_interconvert_complex_to_scalar(r, from, std::integral_constant(), std::integral_constant()); + generic_interconvert(to, r, std::integral_constant::value>(), std::integral_constant::value>()); } template -void generic_interconvert(To& to, const From& from, const mpl::int_& /*to_type*/, const mpl::int_& /*from_type*/) +void generic_interconvert(To& to, const From& from, const std::integral_constant& /*to_type*/, const std::integral_constant& /*from_type*/) { typedef typename component_type >::type component_number; typedef typename component_number::backend_type component_backend; - generic_interconvert_complex_to_scalar(to, from, mpl::bool_::value>(), mpl::bool_::value>()); + generic_interconvert_complex_to_scalar(to, from, std::integral_constant::value>(), std::integral_constant::value>()); } template -void generic_interconvert(To& to, const From& from, const mpl::int_& /*to_type*/, const mpl::int_& /*from_type*/) +void generic_interconvert(To& to, const From& from, const std::integral_constant& /*to_type*/, const std::integral_constant& /*from_type*/) { typedef typename component_type >::type component_number; typedef typename component_number::backend_type component_backend; - generic_interconvert_complex_to_scalar(to, from, mpl::bool_::value>(), mpl::bool_::value>()); + generic_interconvert_complex_to_scalar(to, from, std::integral_constant::value>(), std::integral_constant::value>()); } } diff --git a/include/boost/multiprecision/detail/integer_ops.hpp b/include/boost/multiprecision/detail/integer_ops.hpp index 3fb38a30..4585d287 100644 --- a/include/boost/multiprecision/detail/integer_ops.hpp +++ b/include/boost/multiprecision/detail/integer_ops.hpp @@ -106,7 +106,7 @@ inline BOOST_MP_CXX14_CONSTEXPR void eval_gcd(B& result, const B& a, const B& b) template inline BOOST_MP_CXX14_CONSTEXPR void eval_lcm(B& result, const B& a, const B& b) { - typedef typename mpl::front::type ui_type; + typedef typename std::tuple_element<0, typename B::unsigned_types>::type ui_type; B t; eval_gcd(t, a, b); @@ -272,7 +272,7 @@ struct double_precision_type // check the value is positive: // template -inline BOOST_MP_CXX14_CONSTEXPR void check_sign_of_backend(const Backend& v, const mpl::true_) +inline BOOST_MP_CXX14_CONSTEXPR void check_sign_of_backend(const Backend& v, const std::integral_constant) { if (eval_get_sign(v) < 0) { @@ -280,7 +280,7 @@ inline BOOST_MP_CXX14_CONSTEXPR void check_sign_of_backend(const Backend& v, con } } template -inline BOOST_MP_CXX14_CONSTEXPR void check_sign_of_backend(const Backend&, const mpl::false_) {} +inline BOOST_MP_CXX14_CONSTEXPR void check_sign_of_backend(const Backend&, const std::integral_constant) {} // // Calculate (a^p)%c: // @@ -296,7 +296,7 @@ BOOST_MP_CXX14_CONSTEXPR void eval_powm(Backend& result, const Backend& a, const typedef typename double_precision_type::type double_type; typedef typename boost::multiprecision::detail::canonical::type ui_type; - check_sign_of_backend(p, mpl::bool_ >::is_signed>()); + check_sign_of_backend(p, std::integral_constant >::is_signed>()); double_type x, y(a), b(p), t; x = ui_type(1u); @@ -330,7 +330,7 @@ BOOST_MP_CXX14_CONSTEXPR void eval_powm(Backend& result, const Backend& a, const using default_ops::eval_multiply; using default_ops::eval_right_shift; - check_sign_of_backend(p, mpl::bool_ >::is_signed>()); + check_sign_of_backend(p, std::integral_constant >::is_signed>()); if (eval_get_sign(p) < 0) { diff --git a/include/boost/multiprecision/detail/no_et_ops.hpp b/include/boost/multiprecision/detail/no_et_ops.hpp index b3173bc3..2ab16b67 100644 --- a/include/boost/multiprecision/detail/no_et_ops.hpp +++ b/include/boost/multiprecision/detail/no_et_ops.hpp @@ -292,7 +292,7 @@ namespace boost { { number result(a); using default_ops::eval_left_shift; - detail::check_shift_range(b, mpl::bool_<(sizeof(I) > sizeof(std::size_t))>(), mpl::bool_::value>()); + detail::check_shift_range(b, std::integral_constant sizeof(std::size_t))>(), std::integral_constant::value>()); eval_left_shift(result.backend(), b); return result; } @@ -302,7 +302,7 @@ namespace boost { { number result(a); using default_ops::eval_right_shift; - detail::check_shift_range(b, mpl::bool_<(sizeof(I) > sizeof(std::size_t))>(), mpl::bool_::value>()); + detail::check_shift_range(b, std::integral_constant sizeof(std::size_t))>(), std::integral_constant::value>()); eval_right_shift(result.backend(), b); return result; } diff --git a/include/boost/multiprecision/detail/number_base.hpp b/include/boost/multiprecision/detail/number_base.hpp index 5a49f81f..dc680e2d 100644 --- a/include/boost/multiprecision/detail/number_base.hpp +++ b/include/boost/multiprecision/detail/number_base.hpp @@ -156,27 +156,27 @@ template -struct is_number : public mpl::false_ +struct is_number : public std::integral_constant {}; template -struct is_number > : public mpl::true_ +struct is_number > : public std::integral_constant {}; template -struct is_et_number : public mpl::false_ +struct is_et_number : public std::integral_constant {}; template -struct is_et_number > : public mpl::true_ +struct is_et_number > : public std::integral_constant {}; template -struct is_no_et_number : public mpl::false_ +struct is_no_et_number : public std::integral_constant {}; template -struct is_no_et_number > : public mpl::true_ +struct is_no_et_number > : public std::integral_constant {}; namespace detail { @@ -188,16 +188,16 @@ struct expression; } // namespace detail template -struct is_number_expression : public mpl::false_ +struct is_number_expression : public std::integral_constant {}; template -struct is_number_expression > : public mpl::true_ +struct is_number_expression > : public std::integral_constant {}; template struct is_compatible_arithmetic_type - : public mpl::bool_< + : public std::integral_constant::value && !std::is_same::value && !is_number_expression::value> {}; @@ -257,10 +257,32 @@ template struct has_enough_bits { template - struct type : public mpl::bool_::value >= b> + struct type : public std::integral_constant::value >= b> {}; }; +template ::value)> +struct find_index_of_large_enough_type +{ + static constexpr int value = bits_of::type>::value >= digits ? i : find_index_of_large_enough_type::value; +}; +template +struct find_index_of_large_enough_type +{ + static constexpr int value = INT_MAX; +}; + +template ::value <= index)> +struct dereference_tuple +{ + typedef typename std::tuple_element::type type; +}; +template +struct dereference_tuple +{ + typedef Fallback type; +}; + template struct canonical_imp { @@ -278,48 +300,36 @@ struct canonical_imp, Backend, Tag> }; #ifdef __SUNPRO_CC template -struct canonical_imp, Backend, mpl::int_<3> > +struct canonical_imp, Backend, std::integral_constant > { typedef B type; }; template -struct canonical_imp, Backend, mpl::int_<3> > +struct canonical_imp, Backend, std::integral_constant > { typedef B type; }; #endif template -struct canonical_imp > +struct canonical_imp > { - typedef typename has_enough_bits::value>::template type pred_type; - typedef typename mpl::find_if< - typename Backend::signed_types, - pred_type>::type iter_type; - typedef typename mpl::end::type end_type; - typedef typename mpl::eval_if_c::value, mpl::identity, mpl::deref >::type type; + static constexpr int index = find_index_of_large_enough_type::value>::value; + typedef typename dereference_tuple::type type; }; template -struct canonical_imp > +struct canonical_imp > { - typedef typename has_enough_bits::value>::template type pred_type; - typedef typename mpl::find_if< - typename Backend::unsigned_types, - pred_type>::type iter_type; - typedef typename mpl::end::type end_type; - typedef typename mpl::eval_if_c::value, mpl::identity, mpl::deref >::type type; + static constexpr int index = find_index_of_large_enough_type::value>::value; + typedef typename dereference_tuple::type type; }; template -struct canonical_imp > +struct canonical_imp > { - typedef typename has_enough_bits::value>::template type pred_type; - typedef typename mpl::find_if< - typename Backend::float_types, - pred_type>::type iter_type; - typedef typename mpl::end::type end_type; - typedef typename mpl::eval_if_c::value, mpl::identity, mpl::deref >::type type; + static constexpr int index = find_index_of_large_enough_type::value>::value; + typedef typename dereference_tuple::type type; }; template -struct canonical_imp > +struct canonical_imp > { typedef const char* type; }; @@ -329,17 +339,17 @@ struct canonical { typedef typename std::conditional< boost::multiprecision::detail::is_signed::value && boost::multiprecision::detail::is_integral::value, - mpl::int_<0>, + std::integral_constant, typename std::conditional< boost::multiprecision::detail::is_unsigned::value, - mpl::int_<1>, + std::integral_constant, typename std::conditional< std::is_floating_point::value, - mpl::int_<2>, + std::integral_constant, typename std::conditional< (std::is_convertible::value || std::is_same::value), - mpl::int_<3>, - mpl::int_<4> >::type>::type>::type>::type tag_type; + std::integral_constant, + std::integral_constant >::type>::type>::type>::type tag_type; typedef typename canonical_imp::type type; }; @@ -499,7 +509,7 @@ struct expression_storage > template struct expression { - typedef mpl::int_<1> arity; + typedef std::integral_constant arity; typedef typename arg_type::type left_type; typedef typename left_type::result_type left_result_type; typedef typename left_type::result_type result_type; @@ -653,7 +663,7 @@ struct expression template struct expression { - typedef mpl::int_<0> arity; + typedef std::integral_constant arity; typedef Arg1 result_type; typedef terminal tag_type; @@ -804,7 +814,7 @@ struct expression template struct expression { - typedef mpl::int_<2> arity; + typedef std::integral_constant arity; typedef typename arg_type::type left_type; typedef typename arg_type::type right_type; typedef typename left_type::result_type left_result_type; @@ -964,7 +974,7 @@ struct expression template struct expression { - typedef mpl::int_<3> arity; + typedef std::integral_constant arity; typedef typename arg_type::type left_type; typedef typename arg_type::type middle_type; typedef typename arg_type::type right_type; @@ -1132,7 +1142,7 @@ struct expression template struct expression { - typedef mpl::int_<4> arity; + typedef std::integral_constant arity; typedef typename arg_type::type left_type; typedef typename arg_type::type left_middle_type; typedef typename arg_type::type right_middle_type; @@ -1462,7 +1472,7 @@ void format_float_string(S& str, std::intmax_t my_exp, std::intmax_t digits, std } template -BOOST_MP_CXX14_CONSTEXPR void check_shift_range(V val, const mpl::true_&, const mpl::true_&) +BOOST_MP_CXX14_CONSTEXPR void check_shift_range(V val, const std::integral_constant&, const std::integral_constant&) { if (val > (std::numeric_limits::max)()) BOOST_THROW_EXCEPTION(std::out_of_range("Can not shift by a value greater than std::numeric_limits::max().")); @@ -1470,19 +1480,19 @@ BOOST_MP_CXX14_CONSTEXPR void check_shift_range(V val, const mpl::true_&, const BOOST_THROW_EXCEPTION(std::out_of_range("Can not shift by a negative value.")); } template -BOOST_MP_CXX14_CONSTEXPR void check_shift_range(V val, const mpl::false_&, const mpl::true_&) +BOOST_MP_CXX14_CONSTEXPR void check_shift_range(V val, const std::integral_constant&, const std::integral_constant&) { if (val < 0) BOOST_THROW_EXCEPTION(std::out_of_range("Can not shift by a negative value.")); } template -BOOST_MP_CXX14_CONSTEXPR void check_shift_range(V val, const mpl::true_&, const mpl::false_&) +BOOST_MP_CXX14_CONSTEXPR void check_shift_range(V val, const std::integral_constant&, const std::integral_constant&) { if (val > (std::numeric_limits::max)()) BOOST_THROW_EXCEPTION(std::out_of_range("Can not shift by a value greater than std::numeric_limits::max().")); } template -BOOST_MP_CXX14_CONSTEXPR void check_shift_range(V, const mpl::false_&, const mpl::false_&) BOOST_NOEXCEPT {} +BOOST_MP_CXX14_CONSTEXPR void check_shift_range(V, const std::integral_constant&, const std::integral_constant&) BOOST_NOEXCEPT {} template BOOST_MP_CXX14_CONSTEXPR const T& evaluate_if_expression(const T& val) { return val; } @@ -1505,10 +1515,10 @@ enum number_category_type }; template -struct number_category_base : public mpl::int_ +struct number_category_base : public std::integral_constant {}; template -struct number_category_base : public mpl::int_::is_integer ? number_kind_integer : (std::numeric_limits::max_exponent ? number_kind_floating_point : number_kind_unknown)> +struct number_category_base : public std::integral_constant::is_integer ? number_kind_integer : (std::numeric_limits::max_exponent ? number_kind_floating_point : number_kind_unknown)> {}; template struct number_category : public number_category_base::value || boost::multiprecision::detail::is_arithmetic::value, std::is_abstract::value> @@ -1524,15 +1534,15 @@ struct number_category > : public number // #ifdef BOOST_HAS_INT128 template <> -struct number_category : public mpl::int_ +struct number_category : public std::integral_constant {}; template <> -struct number_category : public mpl::int_ +struct number_category : public std::integral_constant {}; #endif #ifdef BOOST_HAS_FLOAT128 template <> -struct number_category<__float128> : public mpl::int_ +struct number_category<__float128> : public std::integral_constant {}; #endif @@ -1556,16 +1566,16 @@ template struct complex_result_from_scalar; // individual backends must specialize this trait. template -struct is_unsigned_number : public mpl::false_ +struct is_unsigned_number : public std::integral_constant {}; template struct is_unsigned_number > : public is_unsigned_number {}; template -struct is_signed_number : public mpl::bool_::value> +struct is_signed_number : public std::integral_constant::value> {}; template -struct is_interval_number : public mpl::false_ +struct is_interval_number : public std::integral_constant {}; template struct is_interval_number > : public is_interval_number @@ -1614,7 +1624,7 @@ namespace boost { namespace math { } template - struct is_complex_type > : public boost::mpl::bool_::value == boost::multiprecision::number_kind_complex> {}; + struct is_complex_type > : public std::integral_constant::value == boost::multiprecision::number_kind_complex> {}; } // namespace tools diff --git a/include/boost/multiprecision/detail/number_compare.hpp b/include/boost/multiprecision/detail/number_compare.hpp index f8afd92b..12cb20ca 100644 --- a/include/boost/multiprecision/detail/number_compare.hpp +++ b/include/boost/multiprecision/detail/number_compare.hpp @@ -27,13 +27,13 @@ inline BOOST_MP_CXX14_CONSTEXPR bool eval_eq(const B& a, const B& b) return a.compare(b) == 0; } template -inline BOOST_MP_CXX14_CONSTEXPR bool eval_eq_imp(const T& a, const U& b, const mpl::true_&) +inline BOOST_MP_CXX14_CONSTEXPR bool eval_eq_imp(const T& a, const U& b, const std::integral_constant&) { typename boost::multiprecision::detail::number_from_backend::type t(b); return eval_eq(a, t.backend()); } template -inline BOOST_MP_CXX14_CONSTEXPR bool eval_eq_imp(const T& a, const U& b, const mpl::false_&) +inline BOOST_MP_CXX14_CONSTEXPR bool eval_eq_imp(const T& a, const U& b, const std::integral_constant&) { typename boost::multiprecision::detail::number_from_backend::type t(a); return eval_eq(t.backend(), b); @@ -41,7 +41,7 @@ inline BOOST_MP_CXX14_CONSTEXPR bool eval_eq_imp(const T& a, const U& b, const m template inline BOOST_MP_CXX14_CONSTEXPR bool eval_eq(const T& a, const U& b) { - typedef mpl::bool_::value> tag_type; + typedef std::integral_constant::value> tag_type; return eval_eq_imp(a, b, tag_type()); } @@ -51,13 +51,13 @@ inline BOOST_MP_CXX14_CONSTEXPR bool eval_lt(const B& a, const B& b) return a.compare(b) < 0; } template -inline BOOST_MP_CXX14_CONSTEXPR bool eval_lt_imp(const T& a, const U& b, const mpl::true_&) +inline BOOST_MP_CXX14_CONSTEXPR bool eval_lt_imp(const T& a, const U& b, const std::integral_constant&) { typename boost::multiprecision::detail::number_from_backend::type t(b); return eval_lt(a, t.backend()); } template -inline BOOST_MP_CXX14_CONSTEXPR bool eval_lt_imp(const T& a, const U& b, const mpl::false_&) +inline BOOST_MP_CXX14_CONSTEXPR bool eval_lt_imp(const T& a, const U& b, const std::integral_constant&) { typename boost::multiprecision::detail::number_from_backend::type t(a); return eval_lt(t.backend(), b); @@ -65,7 +65,7 @@ inline BOOST_MP_CXX14_CONSTEXPR bool eval_lt_imp(const T& a, const U& b, const m template inline BOOST_MP_CXX14_CONSTEXPR bool eval_lt(const T& a, const U& b) { - typedef mpl::bool_::value> tag_type; + typedef std::integral_constant::value> tag_type; return eval_lt_imp(a, b, tag_type()); } @@ -75,13 +75,13 @@ inline BOOST_MP_CXX14_CONSTEXPR bool eval_gt(const B& a, const B& b) return a.compare(b) > 0; } template -inline BOOST_MP_CXX14_CONSTEXPR bool eval_gt_imp(const T& a, const U& b, const mpl::true_&) +inline BOOST_MP_CXX14_CONSTEXPR bool eval_gt_imp(const T& a, const U& b, const std::integral_constant&) { typename boost::multiprecision::detail::number_from_backend::type t(b); return eval_gt(a, t.backend()); } template -inline BOOST_MP_CXX14_CONSTEXPR bool eval_gt_imp(const T& a, const U& b, const mpl::false_&) +inline BOOST_MP_CXX14_CONSTEXPR bool eval_gt_imp(const T& a, const U& b, const std::integral_constant&) { typename boost::multiprecision::detail::number_from_backend::type t(a); return eval_gt(t.backend(), b); @@ -89,7 +89,7 @@ inline BOOST_MP_CXX14_CONSTEXPR bool eval_gt_imp(const T& a, const U& b, const m template inline BOOST_MP_CXX14_CONSTEXPR bool eval_gt(const T& a, const U& b) { - typedef mpl::bool_::value> tag_type; + typedef std::integral_constant::value> tag_type; return eval_gt_imp(a, b, tag_type()); } @@ -98,7 +98,7 @@ inline BOOST_MP_CXX14_CONSTEXPR bool eval_gt(const T& a, const U& b) namespace detail { template -struct is_valid_mixed_compare : public mpl::false_ +struct is_valid_mixed_compare : public std::integral_constant {}; template @@ -106,7 +106,7 @@ struct is_valid_mixed_compare, Val> : public std::is_convertible -struct is_valid_mixed_compare, number > : public mpl::false_ +struct is_valid_mixed_compare, number > : public std::integral_constant {}; template diff --git a/include/boost/multiprecision/detail/precision.hpp b/include/boost/multiprecision/detail/precision.hpp index db77c802..ee073c1b 100644 --- a/include/boost/multiprecision/detail/precision.hpp +++ b/include/boost/multiprecision/detail/precision.hpp @@ -13,12 +13,12 @@ namespace boost { namespace multiprecision { namespace detail { template -inline constexpr unsigned current_precision_of_last_chance_imp(const boost::multiprecision::number&, const mpl::false_&) +inline constexpr unsigned current_precision_of_last_chance_imp(const boost::multiprecision::number&, const std::integral_constant&) { return std::numeric_limits >::digits10; } template -inline BOOST_MP_CXX14_CONSTEXPR unsigned current_precision_of_last_chance_imp(const boost::multiprecision::number& val, const mpl::true_&) +inline BOOST_MP_CXX14_CONSTEXPR unsigned current_precision_of_last_chance_imp(const boost::multiprecision::number& val, const std::integral_constant&) { // // We have an arbitrary precision integer, take it's "precision" as the @@ -38,7 +38,7 @@ template inline constexpr unsigned current_precision_of_imp(const boost::multiprecision::number& val, const std::integral_constant&) { return current_precision_of_last_chance_imp(val, - mpl::bool_ < + std::integral_constant >::is_specialized && std::numeric_limits >::is_integer && std::numeric_limits >::is_exact && !std::numeric_limits >::is_modulo > ()); } @@ -158,10 +158,10 @@ struct scoped_default_precision }; template -inline BOOST_MP_CXX14_CONSTEXPR void maybe_promote_precision(T*, const mpl::false_&) {} +inline BOOST_MP_CXX14_CONSTEXPR void maybe_promote_precision(T*, const std::integral_constant&) {} template -inline BOOST_MP_CXX14_CONSTEXPR void maybe_promote_precision(T* obj, const mpl::true_&) +inline BOOST_MP_CXX14_CONSTEXPR void maybe_promote_precision(T* obj, const std::integral_constant&) { if (obj->precision() != T::default_precision()) { @@ -172,7 +172,7 @@ inline BOOST_MP_CXX14_CONSTEXPR void maybe_promote_precision(T* obj, const mpl:: template inline BOOST_MP_CXX14_CONSTEXPR void maybe_promote_precision(T* obj) { - maybe_promote_precision(obj, mpl::bool_::value>()); + maybe_promote_precision(obj, std::integral_constant::value>()); } #ifndef BOOST_NO_CXX17_IF_CONSTEXPR diff --git a/include/boost/multiprecision/eigen.hpp b/include/boost/multiprecision/eigen.hpp index 247aeac7..00b2512b 100644 --- a/include/boost/multiprecision/eigen.hpp +++ b/include/boost/multiprecision/eigen.hpp @@ -47,18 +47,18 @@ struct NumTraits > { return (std::numeric_limits::min)(); } - static int digits10_imp(const boost::mpl::true_&) + static int digits10_imp(const std::integral_constant&) { return std::numeric_limits::digits10; } template - static int digits10_imp(const boost::mpl::bool_&) + static int digits10_imp(const std::integral_constant&) { return Real::default_precision(); } static int digits10() { - return digits10_imp(boost::mpl::bool_ < std::numeric_limits::digits10 && (std::numeric_limits::digits10 != INT_MAX) ? true : false > ()); + return digits10_imp(std::integral_constant::digits10 && (std::numeric_limits::digits10 != INT_MAX) ? true : false > ()); } }; template diff --git a/include/boost/multiprecision/float128.hpp b/include/boost/multiprecision/float128.hpp index 2bbc3b5c..e48bf9f7 100644 --- a/include/boost/multiprecision/float128.hpp +++ b/include/boost/multiprecision/float128.hpp @@ -7,7 +7,6 @@ #define BOOST_MP_FLOAT128_HPP #include -#include #include #include @@ -133,11 +132,11 @@ struct float128_backend; using backends::float128_backend; template <> -struct number_category : public mpl::int_ +struct number_category : public std::integral_constant {}; #if defined(BOOST_MP_USE_QUAD) template <> -struct number_category : public mpl::int_ +struct number_category : public std::integral_constant {}; #endif @@ -162,11 +161,11 @@ namespace backends { struct float128_backend { - typedef mpl::list signed_types; - typedef mpl::list signed_types; + typedef std::tuple unsigned_types; - typedef mpl::list float_types; + typedef std::tuple float_types; typedef int exponent_type; private: @@ -259,7 +258,7 @@ struct float128_backend if ((v < 0) || (v >= 127)) { int v_max = v; - boost::scoped_array buf2; + std::unique_ptr buf2; buf2.reset(new char[v + 3]); v = quadmath_snprintf(&buf2[0], v_max + 3, format.c_str(), digits, m_value); if (v >= v_max + 3) @@ -741,7 +740,7 @@ namespace serialization { namespace float128_detail { template -void do_serialize(Archive& ar, boost::multiprecision::backends::float128_backend& val, const mpl::false_&, const mpl::false_&) +void do_serialize(Archive& ar, boost::multiprecision::backends::float128_backend& val, const std::integral_constant&, const std::integral_constant&) { // saving // non-binary @@ -749,7 +748,7 @@ void do_serialize(Archive& ar, boost::multiprecision::backends::float128_backend ar& boost::make_nvp("value", s); } template -void do_serialize(Archive& ar, boost::multiprecision::backends::float128_backend& val, const mpl::true_&, const mpl::false_&) +void do_serialize(Archive& ar, boost::multiprecision::backends::float128_backend& val, const std::integral_constant&, const std::integral_constant&) { // loading // non-binary @@ -759,14 +758,14 @@ void do_serialize(Archive& ar, boost::multiprecision::backends::float128_backend } template -void do_serialize(Archive& ar, boost::multiprecision::backends::float128_backend& val, const mpl::false_&, const mpl::true_&) +void do_serialize(Archive& ar, boost::multiprecision::backends::float128_backend& val, const std::integral_constant&, const std::integral_constant&) { // saving // binary ar.save_binary(&val, sizeof(val)); } template -void do_serialize(Archive& ar, boost::multiprecision::backends::float128_backend& val, const mpl::true_&, const mpl::true_&) +void do_serialize(Archive& ar, boost::multiprecision::backends::float128_backend& val, const std::integral_constant&, const std::integral_constant&) { // loading // binary @@ -779,7 +778,7 @@ template void serialize(Archive& ar, boost::multiprecision::backends::float128_backend& val, unsigned int /*version*/) { typedef typename Archive::is_loading load_tag; - typedef typename mpl::bool_::value || std::is_same::value> binary_tag; + typedef typename std::integral_constant::value || std::is_same::value> binary_tag; float128_detail::do_serialize(ar, val, load_tag(), binary_tag()); } diff --git a/include/boost/multiprecision/gmp.hpp b/include/boost/multiprecision/gmp.hpp index d845a53d..6a1a605e 100644 --- a/include/boost/multiprecision/gmp.hpp +++ b/include/boost/multiprecision/gmp.hpp @@ -63,13 +63,13 @@ struct gmp_rational; } // namespace backends template <> -struct number_category : public mpl::int_ +struct number_category : public std::integral_constant {}; template <> -struct number_category : public mpl::int_ +struct number_category : public std::integral_constant {}; template -struct number_category > : public mpl::int_ +struct number_category > : public std::integral_constant {}; namespace backends { @@ -84,13 +84,13 @@ template struct gmp_float_imp { #ifdef BOOST_HAS_LONG_LONG - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; + typedef std::tuple signed_types; + typedef std::tuple unsigned_types; #else - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; + typedef std::tuple signed_types; + typedef std::tuple unsigned_types; #endif - typedef mpl::list float_types; + typedef std::tuple float_types; typedef long exponent_type; gmp_float_imp() BOOST_NOEXCEPT @@ -1111,13 +1111,13 @@ inline std::size_t hash_value(const gmp_float& val) struct gmp_int { #ifdef BOOST_HAS_LONG_LONG - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; + typedef std::tuple signed_types; + typedef std::tuple unsigned_types; #else - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; + typedef std::tuple signed_types; + typedef std::tuple unsigned_types; #endif - typedef mpl::list float_types; + typedef std::tuple float_types; gmp_int() { @@ -2017,13 +2017,13 @@ void eval_add(gmp_rational& t, const gmp_rational& o); struct gmp_rational { #ifdef BOOST_HAS_LONG_LONG - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; + typedef std::tuple signed_types; + typedef std::tuple unsigned_types; #else - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; + typedef std::tuple signed_types; + typedef std::tuple unsigned_types; #endif - typedef mpl::list float_types; + typedef std::tuple float_types; gmp_rational() { @@ -2586,13 +2586,13 @@ struct transcendental_reduction_type -struct number_category::type> : public mpl::int_ +struct number_category::type> : public std::integral_constant {}; template <> -struct number_category::type> : public mpl::int_ +struct number_category::type> : public std::integral_constant {}; template <> -struct number_category >::type> : public mpl::int_ +struct number_category >::type> : public std::integral_constant {}; namespace detail { diff --git a/include/boost/multiprecision/mpc.hpp b/include/boost/multiprecision/mpc.hpp index 95f75cb8..789c3ad3 100644 --- a/include/boost/multiprecision/mpc.hpp +++ b/include/boost/multiprecision/mpc.hpp @@ -33,7 +33,7 @@ struct mpc_complex_backend; } // namespace backends template -struct number_category > : public mpl::int_ +struct number_category > : public std::integral_constant {}; namespace backends { @@ -62,13 +62,13 @@ template struct mpc_complex_imp { #ifdef BOOST_HAS_LONG_LONG - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; + typedef std::tuple signed_types; + typedef std::tuple unsigned_types; #else - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; + typedef std::tuple signed_types; + typedef std::tuple unsigned_types; #endif - typedef mpl::list float_types; + typedef std::tuple float_types; typedef long exponent_type; mpc_complex_imp() @@ -1475,7 +1475,7 @@ struct is_variable_precision > : public std::in } // namespace detail template <> -struct number_category >::type> : public mpl::int_ +struct number_category >::type> : public std::integral_constant {}; using boost::multiprecision::backends::mpc_complex_backend; diff --git a/include/boost/multiprecision/mpfi.hpp b/include/boost/multiprecision/mpfi.hpp index ef6b970a..d55312da 100644 --- a/include/boost/multiprecision/mpfi.hpp +++ b/include/boost/multiprecision/mpfi.hpp @@ -35,7 +35,7 @@ struct mpfi_float_backend; } // namespace backends template -struct number_category > : public mpl::int_ +struct number_category > : public std::integral_constant {}; struct interval_error : public std::runtime_error @@ -65,13 +65,13 @@ template struct mpfi_float_imp { #ifdef BOOST_HAS_LONG_LONG - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; + typedef std::tuple signed_types; + typedef std::tuple unsigned_types; #else - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; + typedef std::tuple signed_types; + typedef std::tuple unsigned_types; #endif - typedef mpl::list float_types; + typedef std::tuple float_types; typedef long exponent_type; mpfi_float_imp() @@ -1082,7 +1082,7 @@ inline std::size_t hash_value(const mpfi_float_backend& val) } template -void generic_interconvert(To& to, const mpfi_float_backend& from, const mpl::int_& to_type, const mpl::int_& from_type) +void generic_interconvert(To& to, const mpfi_float_backend& from, const std::integral_constant& to_type, const std::integral_constant& from_type) { using boost::multiprecision::detail::generic_interconvert; mpfr_float_backend t; @@ -1091,7 +1091,7 @@ void generic_interconvert(To& to, const mpfi_float_backend& from, const mpl:: } template -void generic_interconvert(To& to, const mpfi_float_backend& from, const mpl::int_& to_type, const mpl::int_& from_type) +void generic_interconvert(To& to, const mpfi_float_backend& from, const std::integral_constant& to_type, const std::integral_constant& from_type) { using boost::multiprecision::detail::generic_interconvert; mpfr_float_backend t; @@ -1100,7 +1100,7 @@ void generic_interconvert(To& to, const mpfi_float_backend& from, const mpl:: } template -void generic_interconvert(To& to, const mpfi_float_backend& from, const mpl::int_& to_type, const mpl::int_& from_type) +void generic_interconvert(To& to, const mpfi_float_backend& from, const std::integral_constant& to_type, const std::integral_constant& from_type) { using boost::multiprecision::detail::generic_interconvert; mpfr_float_backend t; @@ -1117,10 +1117,10 @@ struct is_variable_precision > : public std::int } // namespace detail template <> -struct number_category >::type> : public mpl::int_ +struct number_category >::type> : public std::integral_constant {}; template -struct is_interval_number > : public mpl::true_ +struct is_interval_number > : public std::integral_constant {}; using boost::multiprecision::backends::mpfi_float_backend; diff --git a/include/boost/multiprecision/mpfr.hpp b/include/boost/multiprecision/mpfr.hpp index 61eefcc4..fdca5953 100644 --- a/include/boost/multiprecision/mpfr.hpp +++ b/include/boost/multiprecision/mpfr.hpp @@ -43,7 +43,7 @@ struct mpfr_float_backend<0, allocate_stack>; } // namespace backends template -struct number_category > : public mpl::int_ +struct number_category > : public std::integral_constant {}; namespace backends { @@ -91,13 +91,13 @@ template struct mpfr_float_imp { #ifdef BOOST_HAS_LONG_LONG - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; + typedef std::tuple signed_types; + typedef std::tuple unsigned_types; #else - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; + typedef std::tuple signed_types; + typedef std::tuple unsigned_types; #endif - typedef mpl::list float_types; + typedef std::tuple float_types; typedef long exponent_type; mpfr_float_imp() @@ -413,13 +413,13 @@ template struct mpfr_float_imp { #ifdef BOOST_HAS_LONG_LONG - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; + typedef std::tuple signed_types; + typedef std::tuple unsigned_types; #else - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; + typedef std::tuple signed_types; + typedef std::tuple unsigned_types; #endif - typedef mpl::list float_types; + typedef std::tuple float_types; typedef long exponent_type; static const unsigned digits2 = (digits10 * 1000uL) / 301uL + ((digits10 * 1000uL) % 301 ? 2u : 1u); @@ -1611,11 +1611,11 @@ struct is_variable_precision > : public std::int } // namespace detail template <> -struct number_category >::type> : public mpl::int_ +struct number_category >::type> : public std::integral_constant {}; template -struct is_equivalent_number_type, backends::mpfr_float_backend > : public mpl::true_ {}; +struct is_equivalent_number_type, backends::mpfr_float_backend > : public std::integral_constant {}; using boost::multiprecision::backends::mpfr_float_backend; diff --git a/include/boost/multiprecision/number.hpp b/include/boost/multiprecision/number.hpp index df2a514c..af7f26de 100644 --- a/include/boost/multiprecision/number.hpp +++ b/include/boost/multiprecision/number.hpp @@ -8,10 +8,6 @@ #include #include -#include -#include -#include -#include #include #include #include @@ -186,7 +182,7 @@ class number template BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, self_type>::value, number&>::type operator=(const detail::expression& e) { - typedef mpl::bool_::result_type>::value> tag_type; + typedef std::integral_constant::result_type>::value> tag_type; detail::scoped_default_precision > precision_guard(e); // // If the current precision of *this differs from that of expression e, then we @@ -209,7 +205,7 @@ class number template BOOST_MP_CXX14_CONSTEXPR number& assign(const detail::expression& e) { - typedef mpl::bool_::result_type>::value> tag_type; + typedef std::integral_constant::result_type>::value> tag_type; detail::scoped_default_precision > precision_guard(e); // // If the current precision of *this differs from that of expression e, then we @@ -622,7 +618,7 @@ class number BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::value, number&>::type operator<<=(V val) { static_assert(number_category::value == number_kind_integer, "The left-shift operation is only valid for integer types"); - detail::check_shift_range(val, mpl::bool_<(sizeof(V) > sizeof(std::size_t))>(), mpl::bool_::value && boost::multiprecision::detail::is_integral::value > ()); + detail::check_shift_range(val, std::integral_constant sizeof(std::size_t))>(), std::integral_constant::value && boost::multiprecision::detail::is_integral::value > ()); eval_left_shift(m_backend, static_cast(canonical_value(val))); return *this; } @@ -631,7 +627,7 @@ class number BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::value, number&>::type operator>>=(V val) { static_assert(number_category::value == number_kind_integer, "The right-shift operation is only valid for integer types"); - detail::check_shift_range(val, mpl::bool_<(sizeof(V) > sizeof(std::size_t))>(), mpl::bool_::value && boost::multiprecision::detail::is_integral::value>()); + detail::check_shift_range(val, std::integral_constant sizeof(std::size_t))>(), std::integral_constant::value && boost::multiprecision::detail::is_integral::value>()); eval_right_shift(m_backend, static_cast(canonical_value(val))); return *this; } @@ -949,13 +945,13 @@ class number private: template - BOOST_MP_CXX14_CONSTEXPR void do_assign(const detail::expression& e, const mpl::true_&) + BOOST_MP_CXX14_CONSTEXPR void do_assign(const detail::expression& e, const std::integral_constant&) { do_assign(e, tag()); } template BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type>::value>::type - do_assign(const detail::expression& e, const mpl::false_&) + do_assign(const detail::expression& e, const std::integral_constant&) { // The result of the expression isn't the same type as this - // create a temporary result and assign it to *this: @@ -965,7 +961,7 @@ class number } template BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type>::value>::type - do_assign(const detail::expression& e, const mpl::false_&) + do_assign(const detail::expression& e, const std::integral_constant&) { // The result of the expression isn't the same type as this - // create a temporary result and assign it to *this: @@ -1404,7 +1400,7 @@ class number { static_assert(number_category::value == number_kind_integer, "The right shift operation is only valid for integer types"); using default_ops::eval_right_shift; - detail::check_shift_range(val, mpl::bool_<(sizeof(Val) > sizeof(std::size_t))>(), mpl::bool_::value && boost::multiprecision::detail::is_integral::value>()); + detail::check_shift_range(val, std::integral_constant sizeof(std::size_t))>(), std::integral_constant::value && boost::multiprecision::detail::is_integral::value>()); eval_right_shift(m_backend, canonical_value(e.value()), static_cast(val)); } @@ -1413,7 +1409,7 @@ class number { static_assert(number_category::value == number_kind_integer, "The left shift operation is only valid for integer types"); using default_ops::eval_left_shift; - detail::check_shift_range(val, mpl::bool_<(sizeof(Val) > sizeof(std::size_t))>(), mpl::bool_::value && boost::multiprecision::detail::is_integral::value>()); + detail::check_shift_range(val, std::integral_constant sizeof(std::size_t))>(), std::integral_constant::value && boost::multiprecision::detail::is_integral::value>()); eval_left_shift(m_backend, canonical_value(e.value()), static_cast(val)); } @@ -1423,7 +1419,7 @@ class number static_assert(number_category::value == number_kind_integer, "The right shift operation is only valid for integer types"); using default_ops::eval_right_shift; self_type temp(e); - detail::check_shift_range(val, mpl::bool_<(sizeof(Val) > sizeof(std::size_t))>(), mpl::bool_::value && boost::multiprecision::detail::is_integral::value>()); + detail::check_shift_range(val, std::integral_constant sizeof(std::size_t))>(), std::integral_constant::value && boost::multiprecision::detail::is_integral::value>()); eval_right_shift(m_backend, temp.backend(), static_cast(val)); } @@ -1433,17 +1429,17 @@ class number static_assert(number_category::value == number_kind_integer, "The left shift operation is only valid for integer types"); using default_ops::eval_left_shift; self_type temp(e); - detail::check_shift_range(val, mpl::bool_<(sizeof(Val) > sizeof(std::size_t))>(), mpl::bool_::value && boost::multiprecision::detail::is_integral::value>()); + detail::check_shift_range(val, std::integral_constant sizeof(std::size_t))>(), std::integral_constant::value && boost::multiprecision::detail::is_integral::value>()); eval_left_shift(m_backend, temp.backend(), static_cast(val)); } template - BOOST_MP_CXX14_CONSTEXPR void do_assign_function(const Exp& e, const mpl::int_<1>&) + BOOST_MP_CXX14_CONSTEXPR void do_assign_function(const Exp& e, const std::integral_constant&) { e.left().value()(&m_backend); } template - BOOST_MP_CXX14_CONSTEXPR void do_assign_function(const Exp& e, const mpl::int_<2>&) + BOOST_MP_CXX14_CONSTEXPR void do_assign_function(const Exp& e, const std::integral_constant&) { typedef typename Exp::right_type right_type; typedef typename right_type::tag_type tag_type; @@ -1461,7 +1457,7 @@ class number f(m_backend, t.backend()); } template - BOOST_MP_CXX14_CONSTEXPR void do_assign_function(const Exp& e, const mpl::int_<3>&) + BOOST_MP_CXX14_CONSTEXPR void do_assign_function(const Exp& e, const std::integral_constant&) { typedef typename Exp::middle_type middle_type; typedef typename middle_type::tag_type tag_type; @@ -1495,7 +1491,7 @@ class number } template - BOOST_MP_CXX14_CONSTEXPR void do_assign_function(const Exp& e, const mpl::int_<4>&) + BOOST_MP_CXX14_CONSTEXPR void do_assign_function(const Exp& e, const std::integral_constant&) { typedef typename Exp::left_middle_type left_type; typedef typename left_type::tag_type left_tag_type; @@ -1900,25 +1896,25 @@ class number return contains_self(e, typename Exp::arity()); } template - BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR bool contains_self(const Exp& e, mpl::int_<0> const&) const BOOST_NOEXCEPT + BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR bool contains_self(const Exp& e, std::integral_constant const&) const BOOST_NOEXCEPT { return is_realy_self(e.value()); } template - BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR bool contains_self(const Exp& e, mpl::int_<1> const&) const BOOST_NOEXCEPT + BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR bool contains_self(const Exp& e, std::integral_constant const&) const BOOST_NOEXCEPT { typedef typename Exp::left_type child_type; return contains_self(e.left(), typename child_type::arity()); } template - BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR bool contains_self(const Exp& e, mpl::int_<2> const&) const BOOST_NOEXCEPT + BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR bool contains_self(const Exp& e, std::integral_constant const&) const BOOST_NOEXCEPT { typedef typename Exp::left_type child0_type; typedef typename Exp::right_type child1_type; return contains_self(e.left(), typename child0_type::arity()) || contains_self(e.right(), typename child1_type::arity()); } template - BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR bool contains_self(const Exp& e, mpl::int_<3> const&) const BOOST_NOEXCEPT + BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR bool contains_self(const Exp& e, std::integral_constant const&) const BOOST_NOEXCEPT { typedef typename Exp::left_type child0_type; typedef typename Exp::middle_type child1_type; @@ -1933,12 +1929,12 @@ class number return is_self(e, typename Exp::arity()); } template - BOOST_MP_FORCEINLINE constexpr bool is_self(const Exp& e, mpl::int_<0> const&) const BOOST_NOEXCEPT + BOOST_MP_FORCEINLINE constexpr bool is_self(const Exp& e, std::integral_constant const&) const BOOST_NOEXCEPT { return is_realy_self(e.value()); } template - BOOST_MP_FORCEINLINE constexpr bool is_self(const Exp&, mpl::int_ const&) const BOOST_NOEXCEPT + BOOST_MP_FORCEINLINE constexpr bool is_self(const Exp&, std::integral_constant const&) const BOOST_NOEXCEPT { return false; } diff --git a/include/boost/multiprecision/rational_adaptor.hpp b/include/boost/multiprecision/rational_adaptor.hpp index f9fe06bd..d055da88 100644 --- a/include/boost/multiprecision/rational_adaptor.hpp +++ b/include/boost/multiprecision/rational_adaptor.hpp @@ -181,7 +181,7 @@ struct rational_adaptor const rational_type& data() const { return m_value; } template - void serialize(Archive& ar, const mpl::true_&) + void serialize(Archive& ar, const std::integral_constant&) { // Saving integer_type n(m_value.numerator()), d(m_value.denominator()); @@ -189,7 +189,7 @@ struct rational_adaptor ar& boost::make_nvp("denominator", d); } template - void serialize(Archive& ar, const mpl::false_&) + void serialize(Archive& ar, const std::integral_constant&) { // Loading integer_type n, d; @@ -201,7 +201,8 @@ struct rational_adaptor void serialize(Archive& ar, const unsigned int /*version*/) { typedef typename Archive::is_saving tag; - serialize(ar, tag()); + typedef std::integral_constant saving_tag; + serialize(ar, saving_tag()); } private: @@ -296,7 +297,7 @@ struct expression_template_default > : pu {}; template -struct number_category > : public mpl::int_ +struct number_category > : public std::integral_constant {}; using boost::multiprecision::backends::rational_adaptor; diff --git a/include/boost/multiprecision/tommath.hpp b/include/boost/multiprecision/tommath.hpp index ac1dd54c..7d8f511e 100644 --- a/include/boost/multiprecision/tommath.hpp +++ b/include/boost/multiprecision/tommath.hpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -43,9 +42,9 @@ void eval_add(tommath_int& t, const tommath_int& o); struct tommath_int { - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; - typedef mpl::list float_types; + typedef std::tuple signed_types; + typedef std::tuple unsigned_types; + typedef std::tuple float_types; tommath_int() { @@ -391,7 +390,7 @@ struct tommath_int std::size_t s; detail::check_tommath_result(mp_radix_size(const_cast< ::mp_int*>(&m_data), base, &s)); #endif - boost::scoped_array a(new char[s + 1]); + std::unique_ptr a(new char[s + 1]); #ifdef DIGIT_BIT detail::check_tommath_result(mp_toradix_n(const_cast< ::mp_int*>(&m_data), a.get(), base, s + 1)); #else @@ -779,7 +778,7 @@ inline std::size_t hash_value(const tommath_int& val) using boost::multiprecision::backends::tommath_int; template <> -struct number_category : public mpl::int_ +struct number_category : public std::integral_constant {}; typedef number tom_int; diff --git a/include/boost/multiprecision/traits/is_backend.hpp b/include/boost/multiprecision/traits/is_backend.hpp index 30be0f6f..7c5b4de3 100644 --- a/include/boost/multiprecision/traits/is_backend.hpp +++ b/include/boost/multiprecision/traits/is_backend.hpp @@ -6,14 +6,37 @@ #ifndef BOOST_MP_IS_BACKEND_HPP #define BOOST_MP_IS_BACKEND_HPP -#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 has_signed_types +{ + template + static double check(U*, typename U::signed_types* = 0); + static char check(...); + static T* get(); + static constexpr bool value = sizeof(check(get())) == sizeof(double); +}; +template +struct has_unsigned_types +{ + template + static double check(U*, typename U::unsigned_types* = 0); + static char check(...); + static T* get(); + static constexpr bool value = sizeof(check(get())) == sizeof(double); +}; +template +struct has_float_types +{ + template + static double check(U*, typename U::float_types* = 0); + static char check(...); + static T* get(); + static constexpr bool value = sizeof(check(get())) == sizeof(double); +}; template struct is_backend diff --git a/include/boost/multiprecision/traits/is_byte_container.hpp b/include/boost/multiprecision/traits/is_byte_container.hpp index 139cd1c0..ead548bc 100644 --- a/include/boost/multiprecision/traits/is_byte_container.hpp +++ b/include/boost/multiprecision/traits/is_byte_container.hpp @@ -8,11 +8,19 @@ #include #include -#include namespace boost { namespace multiprecision { namespace detail { -BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_member_const_iterator, const_iterator, false) +template +struct has_member_const_iterator +{ + template + static double check(U*, typename U::const_iterator* = 0); + static char check(...); + static T* get(); + static constexpr bool value = sizeof(check(get())) == sizeof(double); +}; + template struct is_byte_container_imp diff --git a/include/boost/multiprecision/traits/is_restricted_conversion.hpp b/include/boost/multiprecision/traits/is_restricted_conversion.hpp index b4cc8db2..c87886af 100644 --- a/include/boost/multiprecision/traits/is_restricted_conversion.hpp +++ b/include/boost/multiprecision/traits/is_restricted_conversion.hpp @@ -8,7 +8,6 @@ #define BOOST_MP_RESTRICTED_CONVERSION_HPP #include -#include #include namespace boost { namespace multiprecision { namespace detail { @@ -20,8 +19,8 @@ struct is_lossy_conversion ((number_category::value == number_kind_floating_point) && (number_category::value == number_kind_integer)) /* || ((number_category::value == number_kind_floating_point) && (number_category::value == number_kind_rational))*/ || ((number_category::value == number_kind_rational) && (number_category::value == number_kind_integer)) || ((number_category::value == number_kind_fixed_point) && (number_category::value == number_kind_integer)) || (number_category::value == number_kind_unknown) || (number_category::value == number_kind_unknown), - mpl::true_, - mpl::false_>::type type; + std::integral_constant, + std::integral_constant>::type type; static const bool value = type::value; }; @@ -30,8 +29,8 @@ struct is_restricted_conversion { typedef typename std::conditional< ((is_explicitly_convertible::value && !std::is_convertible::value) || is_lossy_conversion::value), - mpl::true_, - mpl::false_>::type type; + std::integral_constant, + std::integral_constant>::type type; static const bool value = type::value; }; diff --git a/performance/arithmetic_backend.hpp b/performance/arithmetic_backend.hpp index 15074272..8bea69e2 100644 --- a/performance/arithmetic_backend.hpp +++ b/performance/arithmetic_backend.hpp @@ -28,9 +28,9 @@ namespace backends { template struct arithmetic_backend { - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; - typedef mpl::list float_types; + typedef std::tuple signed_types; + typedef std::tuple unsigned_types; + typedef std::tuple float_types; typedef int exponent_type; BOOST_MP_CXX14_CONSTEXPR arithmetic_backend() : m_value(0) {} @@ -83,17 +83,17 @@ struct arithmetic_backend ss << std::setprecision(digits ? digits : std::numeric_limits::digits10 + 4) << m_value; return ss.str(); } - BOOST_MP_CXX14_CONSTEXPR void do_negate(const mpl::true_&) + BOOST_MP_CXX14_CONSTEXPR void do_negate(const std::integral_constant&) { m_value = 1 + ~m_value; } - BOOST_MP_CXX14_CONSTEXPR void do_negate(const mpl::false_&) + BOOST_MP_CXX14_CONSTEXPR void do_negate(const std::integral_constant&) { m_value = -m_value; } BOOST_MP_CXX14_CONSTEXPR void negate() { - do_negate(mpl::bool_::value>()); + do_negate(std::integral_constant::value>()); } BOOST_MP_CXX14_CONSTEXPR int compare(const arithmetic_backend& o) const { @@ -549,7 +549,7 @@ inline BOOST_MP_CXX14_CONSTEXPR std::size_t hash_value(const arithmetic_backend< using boost::multiprecision::backends::arithmetic_backend; template -struct number_category > : public mpl::int_::value ? number_kind_integer : number_kind_floating_point> +struct number_category > : public std::integral_constant::value ? number_kind_integer : number_kind_floating_point> {}; namespace detail { diff --git a/performance/linpack-benchmark.cpp b/performance/linpack-benchmark.cpp index 7fc6a6ce..327822af 100644 --- a/performance/linpack-benchmark.cpp +++ b/performance/linpack-benchmark.cpp @@ -47,7 +47,7 @@ std::ostream& operator<<(std::ostream& os, const __float128& f) namespace boost { template <> -struct has_left_shift, __float128> : public mpl::true_ +struct has_left_shift, __float128> : public std::integral_constant {}; template <> diff --git a/performance/performance_test.hpp b/performance/performance_test.hpp index e6bb22fb..ce741da2 100644 --- a/performance/performance_test.hpp +++ b/performance/performance_test.hpp @@ -484,9 +484,9 @@ struct tester private: T generate_random() { - return generate_random(boost::mpl::int_()); + return generate_random(std::integral_constant()); } - T generate_random(const boost::mpl::int_&) + T generate_random(const std::integral_constant&) { T val = gen(); T prev_val = -1; @@ -503,7 +503,7 @@ struct tester static boost::random::uniform_int_distribution ui(-30, 30); return ldexp(val, static_cast(ui(gen))); } - T generate_random(const boost::mpl::int_&) + T generate_random(const std::integral_constant&) { typedef boost::random::mt19937::result_type random_type; @@ -535,7 +535,7 @@ struct tester val %= max_val; return val; } - T generate_random(const boost::mpl::int_&) + T generate_random(const std::integral_constant&) { typedef boost::random::mt19937::result_type random_type; typedef typename boost::multiprecision::component_type::type IntType; @@ -584,15 +584,15 @@ struct tester template boost::random::mt19937 tester::gen; -inline const char* category_name(const boost::mpl::int_&) +inline const char* category_name(const std::integral_constant&) { return "integer"; } -inline const char* category_name(const boost::mpl::int_&) +inline const char* category_name(const std::integral_constant&) { return "float"; } -inline const char* category_name(const boost::mpl::int_&) +inline const char* category_name(const std::integral_constant&) { return "rational"; } @@ -614,7 +614,7 @@ inline void report_result(const char* cat, const char* type, const char* op, uns } template -void test_int_ops(tester& t, const char* type, unsigned precision, const boost::mpl::int_&) +void test_int_ops(tester& t, const char* type, unsigned precision, const std::integral_constant&) { const char* cat = "integer"; report_result(cat, type, "%", precision, t.test_mod()); diff --git a/test/skeleton_backend.hpp b/test/skeleton_backend.hpp index f0164d77..5634c891 100644 --- a/test/skeleton_backend.hpp +++ b/test/skeleton_backend.hpp @@ -43,9 +43,9 @@ struct skeleton_backend // present in the list will get promoted to the next wider type that is // in the list whenever mixed arithmetic involving that type is encountered. // - typedef mpl::list signed_types; - typedef mpl::list unsigned_types; - typedef mpl::list float_types; + typedef std::tuple signed_types; + typedef std::tuple unsigned_types; + typedef std::tuple float_types; // // This typedef is only required if this is a floating point type, it is the type // which holds the exponent: @@ -1088,7 +1088,7 @@ typedef number skeleton_number; // number_kind_complex // template<> -struct number_category : public mpl::int_ +struct number_category : public std::integral_constant {}; // diff --git a/test/test_adapt_serial.cpp b/test/test_adapt_serial.cpp index 8f7614e3..3862cd1f 100644 --- a/test/test_adapt_serial.cpp +++ b/test/test_adapt_serial.cpp @@ -66,7 +66,7 @@ T generate_random(unsigned bits_wanted) } template -void test_neg(const T& x, const boost::mpl::true_&) +void test_neg(const T& x, const std::integral_constant&) { T val = -x; #ifndef BOOST_NO_EXCEPTIONS @@ -115,7 +115,7 @@ void test_neg(const T& x, const boost::mpl::true_&) #endif } template -void test_neg(const T&, const boost::mpl::false_&) {} +void test_neg(const T&, const std::integral_constant&) {} template void test() @@ -173,7 +173,7 @@ void test() std::cout << e.what() << std::endl; } #endif - test_neg(val, boost::mpl::bool_::is_signed>()); + test_neg(val, std::integral_constant::is_signed>()); // // Check to see if test is taking too long. // Tests run on the compiler farm time out after 300 seconds, diff --git a/test/test_arithmetic.hpp b/test/test_arithmetic.hpp index e992d562..3971526a 100644 --- a/test/test_arithmetic.hpp +++ b/test/test_arithmetic.hpp @@ -14,10 +14,10 @@ #include "test.hpp" template -struct is_boost_rational : public boost::mpl::false_ +struct is_boost_rational : public std::integral_constant {}; template -struct is_checked_cpp_int : public boost::mpl::false_ +struct is_checked_cpp_int : public std::integral_constant {}; #ifdef BOOST_MSVC @@ -63,7 +63,7 @@ abs(boost::multiprecision::detail::expression const } // namespace detail template -struct is_twos_complement_integer : public boost::mpl::true_ +struct is_twos_complement_integer : public std::integral_constant {}; template @@ -229,7 +229,7 @@ void test_conditional(Real v, Exp e) } template -void test_complement(Real a, Real b, Real c, const boost::mpl::true_&) +void test_complement(Real a, Real b, Real c, const std::integral_constant&) { int i = 1020304; int j = 56789123; @@ -249,7 +249,7 @@ void test_complement(Real a, Real b, Real c, const boost::mpl::true_&) } template -void test_complement(Real, Real, Real, const boost::mpl::false_&) +void test_complement(Real, Real, Real, const std::integral_constant&) { } @@ -257,7 +257,7 @@ template void test_integer_ops(const T&) {} template -void test_rational(const boost::mpl::true_&) +void test_rational(const std::integral_constant&) { Real a(2); a /= 3; @@ -277,7 +277,7 @@ void test_rational(const boost::mpl::true_&) } template -void test_rational(const boost::mpl::false_&) +void test_rational(const std::integral_constant&) { Real a(2); a /= 3; @@ -303,13 +303,13 @@ void test_rational(const boost::mpl::false_&) } template -void test_integer_ops(const boost::mpl::int_&) +void test_integer_ops(const std::integral_constant&) { test_rational(is_boost_rational()); } template -void test_signed_integer_ops(const boost::mpl::true_&) +void test_signed_integer_ops(const std::integral_constant&) { Real a(20); Real b(7); @@ -434,17 +434,17 @@ void test_signed_integer_ops(const boost::mpl::true_&) #endif } template -void test_signed_integer_ops(const boost::mpl::false_&) +void test_signed_integer_ops(const std::integral_constant&) { } template -inline Real negate_if_signed(Real r, const boost::mpl::bool_&) +inline Real negate_if_signed(Real r, const std::integral_constant&) { return -r; } template -inline Real negate_if_signed(Real r, const boost::mpl::bool_&) +inline Real negate_if_signed(Real r, const std::integral_constant&) { return r; } @@ -506,7 +506,7 @@ void test_integer_overflow() m = 2u; m = pow(m, (std::min)(std::numeric_limits::digits - 1, 1000)); ++m; - m = negate_if_signed(m, boost::mpl::bool_::is_signed>()); + m = negate_if_signed(m, std::integral_constant::is_signed>()); if (is_checked_cpp_int::value) { BOOST_CHECK_THROW(m.template convert_to(), std::overflow_error); @@ -522,12 +522,12 @@ void test_integer_overflow() // signed to unsigned converison with overflow, it's really not clear what should happen here! m = (std::numeric_limits::max)(); ++m; - m = negate_if_signed(m, boost::mpl::bool_::is_signed>()); + m = negate_if_signed(m, std::integral_constant::is_signed>()); BOOST_CHECK_THROW(m.template convert_to(), std::range_error); // Again with much larger value: m = 2u; m = pow(m, (std::min)(std::numeric_limits::digits - 1, 1000)); - m = negate_if_signed(m, boost::mpl::bool_::is_signed>()); + m = negate_if_signed(m, std::integral_constant::is_signed>()); BOOST_CHECK_THROW(m.template convert_to(), std::range_error); } } @@ -552,9 +552,9 @@ void test_integer_round_trip() } template -void test_integer_ops(const boost::mpl::int_&) +void test_integer_ops(const std::integral_constant&) { - test_signed_integer_ops(boost::mpl::bool_::is_signed>()); + test_signed_integer_ops(std::integral_constant::is_signed>()); Real a(20); Real b(7); @@ -958,7 +958,7 @@ template void test_float_funcs(const T&) {} template -void test_float_funcs(const boost::mpl::true_&) +void test_float_funcs(const std::integral_constant&) { if (boost::multiprecision::is_interval_number::value) return; @@ -1198,7 +1198,7 @@ template void test_float_ops(const T&) {} template -void test_float_ops(const boost::mpl::int_&) +void test_float_ops(const std::integral_constant&) { BOOST_CHECK_EQUAL(abs(Real(2)), 2); BOOST_CHECK_EQUAL(abs(Real(-2)), 2); @@ -1423,7 +1423,7 @@ void test_float_ops(const boost::mpl::int_(boost::mpl::bool_::is_specialized>()); + test_float_funcs(std::integral_constant::is_specialized>()); } template @@ -1439,7 +1439,7 @@ struct lexical_cast_target_type }; template -void test_negative_mixed_minmax(boost::mpl::true_ const&) +void test_negative_mixed_minmax(std::integral_constant const&) { if (!std::numeric_limits::is_bounded || (std::numeric_limits::digits >= std::numeric_limits::digits)) { @@ -1466,12 +1466,12 @@ void test_negative_mixed_minmax(boost::mpl::true_ const&) } } template -void test_negative_mixed_minmax(boost::mpl::false_ const&) +void test_negative_mixed_minmax(std::integral_constant const&) { } template -void test_negative_mixed_numeric_limits(boost::mpl::true_ const&) +void test_negative_mixed_numeric_limits(std::integral_constant const&) { typedef typename lexical_cast_target_type::type target_type; #if defined(TEST_MPFR) @@ -1498,10 +1498,10 @@ void test_negative_mixed_numeric_limits(boost::mpl::true_ const&) } template -void test_negative_mixed_numeric_limits(boost::mpl::false_ const&) {} +void test_negative_mixed_numeric_limits(std::integral_constant const&) {} template -void test_negative_mixed(boost::mpl::true_ const&) +void test_negative_mixed(std::integral_constant const&) { typedef typename std::conditional< std::is_convertible::value, @@ -1552,7 +1552,7 @@ void test_negative_mixed(boost::mpl::true_ const&) BOOST_CHECK_EQUAL(static_cast((Real(n2) + 0)), n2); BOOST_CHECK_EQUAL(static_cast((Real(n3) + 0)), n3); BOOST_CHECK_EQUAL(static_cast((Real(n4) + 0)), n4); - test_negative_mixed_numeric_limits(boost::mpl::bool_::is_specialized>()); + test_negative_mixed_numeric_limits(std::integral_constant::is_specialized>()); // Assignment: Real r(0); BOOST_CHECK(r != static_cast(n1)); @@ -1768,7 +1768,7 @@ void test_negative_mixed(boost::mpl::true_ const&) // // Conversion from min and max values: // - test_negative_mixed_minmax(boost::mpl::bool_ < std::numeric_limits::is_integer && std::numeric_limits::is_integer > ()); + test_negative_mixed_minmax(std::integral_constant::is_integer && std::numeric_limits::is_integer > ()); // // RValue ref overloads: // @@ -1794,38 +1794,38 @@ void test_negative_mixed(boost::mpl::true_ const&) } template -void test_negative_mixed(boost::mpl::false_ const&) +void test_negative_mixed(std::integral_constant const&) { } template -void test_mixed(const boost::mpl::false_&) +void test_mixed(const std::integral_constant&) { } template -inline bool check_is_nan(const Real& val, const boost::mpl::true_&) +inline bool check_is_nan(const Real& val, const std::integral_constant&) { return (boost::math::isnan)(val); } template -inline bool check_is_nan(const Real&, const boost::mpl::false_&) +inline bool check_is_nan(const Real&, const std::integral_constant&) { return false; } template -inline Real negate_value(const Real& val, const boost::mpl::true_&) +inline Real negate_value(const Real& val, const std::integral_constant&) { return -val; } template -inline Real negate_value(const Real& val, const boost::mpl::false_&) +inline Real negate_value(const Real& val, const std::integral_constant&) { return val; } template -void test_mixed_numeric_limits(const boost::mpl::true_&) +void test_mixed_numeric_limits(const std::integral_constant&) { typedef typename lexical_cast_target_type::type target_type; #if defined(TEST_MPFR) @@ -1839,15 +1839,15 @@ void test_mixed_numeric_limits(const boost::mpl::true_&) { d = static_cast(std::numeric_limits::infinity()); BOOST_CHECK_GT(d, (std::numeric_limits::max)()); - d = static_cast(negate_value(std::numeric_limits::infinity(), boost::mpl::bool_::is_signed>())); - BOOST_CHECK_LT(d, negate_value((std::numeric_limits::max)(), boost::mpl::bool_::is_signed>())); + d = static_cast(negate_value(std::numeric_limits::infinity(), std::integral_constant::is_signed>())); + BOOST_CHECK_LT(d, negate_value((std::numeric_limits::max)(), std::integral_constant::is_signed>())); } if (std::numeric_limits::has_quiet_NaN && std::numeric_limits::has_quiet_NaN) { d = static_cast(std::numeric_limits::quiet_NaN()); - BOOST_CHECK(check_is_nan(d, boost::mpl::bool_::has_quiet_NaN>())); - d = static_cast(negate_value(std::numeric_limits::quiet_NaN(), boost::mpl::bool_::is_signed>())); - BOOST_CHECK(check_is_nan(d, boost::mpl::bool_::has_quiet_NaN>())); + BOOST_CHECK(check_is_nan(d, std::integral_constant::has_quiet_NaN>())); + d = static_cast(negate_value(std::numeric_limits::quiet_NaN(), std::integral_constant::is_signed>())); + BOOST_CHECK(check_is_nan(d, std::integral_constant::has_quiet_NaN>())); } static const int left_shift = std::numeric_limits::digits - 1; @@ -1869,12 +1869,12 @@ void test_mixed_numeric_limits(const boost::mpl::true_&) BOOST_CHECK_CLOSE(n4, checked_lexical_cast(Real(n4).str(digits_to_print, f)), 0); } template -void test_mixed_numeric_limits(const boost::mpl::false_&) +void test_mixed_numeric_limits(const std::integral_constant&) { } template -void test_mixed(const boost::mpl::true_&) +void test_mixed(const std::integral_constant&) { typedef typename std::conditional< std::is_convertible::value, @@ -1976,7 +1976,7 @@ void test_mixed(const boost::mpl::true_&) r = static_cast(Num(4) * n4) / Real(4); BOOST_CHECK_EQUAL(r, static_cast(n4)); - typedef boost::mpl::bool_< + typedef std::integral_constant::is_specialized || std::numeric_limits::is_signed) && (!std::numeric_limits::is_specialized || std::numeric_limits::is_signed)> signed_tag; @@ -2053,7 +2053,7 @@ void test_mixed(const boost::mpl::true_&) d = b * static_cast(n3) - static_cast(n1); BOOST_CHECK_EQUAL(d, 3 * 4 - 2); - test_mixed_numeric_limits(boost::mpl::bool_::is_specialized>()); + test_mixed_numeric_limits(std::integral_constant::is_specialized>()); } template @@ -2535,7 +2535,7 @@ void test_members(boost::rational) } template -void test_signed_ops(const boost::mpl::true_&) +void test_signed_ops(const std::integral_constant&) { Real a(8); Real b(64); @@ -2639,7 +2639,7 @@ void test_signed_ops(const boost::mpl::true_&) BOOST_CHECK_EQUAL(c, -2); } template -void test_signed_ops(const boost::mpl::false_&) +void test_signed_ops(const std::integral_constant&) { } @@ -2857,11 +2857,11 @@ void test() test_mixed(tag); typedef typename related_type::type related_type; - boost::mpl::bool_::value && !std::is_same::value> tag2; + std::integral_constant::value && !std::is_same::value> tag2; test_mixed(tag2); - boost::mpl::bool_::value && (boost::multiprecision::number_category::value == boost::multiprecision::number_kind_complex)> complex_tag; + std::integral_constant::value && (boost::multiprecision::number_category::value == boost::multiprecision::number_kind_complex)> complex_tag; test_mixed >(complex_tag); test_mixed >(complex_tag); test_mixed >(complex_tag); @@ -3136,7 +3136,7 @@ void test() test_conditional(a, +a); test_conditional(a, (a + 0)); - test_signed_ops(boost::mpl::bool_::is_signed>()); + test_signed_ops(std::integral_constant::is_signed>()); // // Test hashing: // diff --git a/test/test_arithmetic_cpp_int_1.cpp b/test/test_arithmetic_cpp_int_1.cpp index d74e0b74..268a333a 100644 --- a/test/test_arithmetic_cpp_int_1.cpp +++ b/test/test_arithmetic_cpp_int_1.cpp @@ -8,7 +8,7 @@ #include "test_arithmetic.hpp" template -struct is_twos_complement_integer, ExpressionTemplates> > : public boost::mpl::false_ +struct is_twos_complement_integer, ExpressionTemplates> > : public std::integral_constant {}; template <> diff --git a/test/test_arithmetic_cpp_int_10.cpp b/test/test_arithmetic_cpp_int_10.cpp index fcc6fa1b..2e75d14b 100644 --- a/test/test_arithmetic_cpp_int_10.cpp +++ b/test/test_arithmetic_cpp_int_10.cpp @@ -8,7 +8,7 @@ #include "test_arithmetic.hpp" template -struct is_twos_complement_integer, ExpressionTemplates> > : public boost::mpl::false_ +struct is_twos_complement_integer, ExpressionTemplates> > : public std::integral_constant {}; template <> diff --git a/test/test_arithmetic_cpp_int_11.cpp b/test/test_arithmetic_cpp_int_11.cpp index 575a2473..84d6d8d0 100644 --- a/test/test_arithmetic_cpp_int_11.cpp +++ b/test/test_arithmetic_cpp_int_11.cpp @@ -8,11 +8,11 @@ #include "test_arithmetic.hpp" template -struct is_checked_cpp_int, ET> > : public boost::mpl::true_ +struct is_checked_cpp_int, ET> > : public std::integral_constant {}; template -struct is_twos_complement_integer, ExpressionTemplates> > : public boost::mpl::false_ +struct is_twos_complement_integer, ExpressionTemplates> > : public std::integral_constant {}; template <> diff --git a/test/test_arithmetic_cpp_int_12.cpp b/test/test_arithmetic_cpp_int_12.cpp index 030d055f..941fe30f 100644 --- a/test/test_arithmetic_cpp_int_12.cpp +++ b/test/test_arithmetic_cpp_int_12.cpp @@ -8,11 +8,11 @@ #include "test_arithmetic.hpp" template -struct is_checked_cpp_int, ET> > : public boost::mpl::true_ +struct is_checked_cpp_int, ET> > : public std::integral_constant {}; template -struct is_twos_complement_integer, ExpressionTemplates> > : public boost::mpl::false_ +struct is_twos_complement_integer, ExpressionTemplates> > : public std::integral_constant {}; template <> diff --git a/test/test_arithmetic_cpp_int_13.cpp b/test/test_arithmetic_cpp_int_13.cpp index 76d26def..84142edd 100644 --- a/test/test_arithmetic_cpp_int_13.cpp +++ b/test/test_arithmetic_cpp_int_13.cpp @@ -8,11 +8,11 @@ #include "test_arithmetic.hpp" template -struct is_checked_cpp_int, ET> > : public boost::mpl::true_ +struct is_checked_cpp_int, ET> > : public std::integral_constant {}; template -struct is_twos_complement_integer, ExpressionTemplates> > : public boost::mpl::false_ +struct is_twos_complement_integer, ExpressionTemplates> > : public std::integral_constant {}; template <> diff --git a/test/test_arithmetic_cpp_int_14.cpp b/test/test_arithmetic_cpp_int_14.cpp index b3825c06..0603068b 100644 --- a/test/test_arithmetic_cpp_int_14.cpp +++ b/test/test_arithmetic_cpp_int_14.cpp @@ -8,7 +8,7 @@ #include "test_arithmetic.hpp" template -struct is_twos_complement_integer, ExpressionTemplates> > : public boost::mpl::false_ +struct is_twos_complement_integer, ExpressionTemplates> > : public std::integral_constant {}; template <> diff --git a/test/test_arithmetic_cpp_int_15.cpp b/test/test_arithmetic_cpp_int_15.cpp index 6be2ace9..93d94a2c 100644 --- a/test/test_arithmetic_cpp_int_15.cpp +++ b/test/test_arithmetic_cpp_int_15.cpp @@ -8,11 +8,11 @@ #include "test_arithmetic.hpp" template -struct is_checked_cpp_int, ET> > : public boost::mpl::true_ +struct is_checked_cpp_int, ET> > : public std::integral_constant {}; template -struct is_twos_complement_integer, ExpressionTemplates> > : public boost::mpl::false_ +struct is_twos_complement_integer, ExpressionTemplates> > : public std::integral_constant {}; template <> diff --git a/test/test_arithmetic_cpp_int_16.cpp b/test/test_arithmetic_cpp_int_16.cpp index df2da56a..487ad7d6 100644 --- a/test/test_arithmetic_cpp_int_16.cpp +++ b/test/test_arithmetic_cpp_int_16.cpp @@ -8,11 +8,11 @@ #include "test_arithmetic.hpp" template -struct is_checked_cpp_int, ET> > : public boost::mpl::true_ +struct is_checked_cpp_int, ET> > : public std::integral_constant {}; template -struct is_twos_complement_integer, ExpressionTemplates> > : public boost::mpl::false_ +struct is_twos_complement_integer, ExpressionTemplates> > : public std::integral_constant {}; template <> diff --git a/test/test_arithmetic_cpp_int_17.cpp b/test/test_arithmetic_cpp_int_17.cpp index 0aa0c02b..babe96a8 100644 --- a/test/test_arithmetic_cpp_int_17.cpp +++ b/test/test_arithmetic_cpp_int_17.cpp @@ -8,7 +8,7 @@ #include "test_arithmetic.hpp" template -struct is_twos_complement_integer, ExpressionTemplates> > : public boost::mpl::false_ +struct is_twos_complement_integer, ExpressionTemplates> > : public std::integral_constant {}; template <> @@ -23,7 +23,7 @@ struct related_type -struct is_checked_cpp_int > > : public boost::mpl::true_ +struct is_checked_cpp_int > > : public std::integral_constant {}; int main() diff --git a/test/test_arithmetic_cpp_int_18.cpp b/test/test_arithmetic_cpp_int_18.cpp index a822d112..9a2bc496 100644 --- a/test/test_arithmetic_cpp_int_18.cpp +++ b/test/test_arithmetic_cpp_int_18.cpp @@ -8,11 +8,11 @@ #include "test_arithmetic.hpp" template -struct is_checked_cpp_int, ET> > : public boost::mpl::true_ +struct is_checked_cpp_int, ET> > : public std::integral_constant {}; template -struct is_twos_complement_integer, ExpressionTemplates> > : public boost::mpl::false_ +struct is_twos_complement_integer, ExpressionTemplates> > : public std::integral_constant {}; template <> diff --git a/test/test_arithmetic_cpp_int_19.cpp b/test/test_arithmetic_cpp_int_19.cpp index 8b49e01e..528cecbc 100644 --- a/test/test_arithmetic_cpp_int_19.cpp +++ b/test/test_arithmetic_cpp_int_19.cpp @@ -8,7 +8,7 @@ #include "test_arithmetic.hpp" template -struct is_twos_complement_integer, ExpressionTemplates> > : public boost::mpl::false_ +struct is_twos_complement_integer, ExpressionTemplates> > : public std::integral_constant {}; int main() diff --git a/test/test_arithmetic_cpp_int_2.cpp b/test/test_arithmetic_cpp_int_2.cpp index f2de6dfa..497c204e 100644 --- a/test/test_arithmetic_cpp_int_2.cpp +++ b/test/test_arithmetic_cpp_int_2.cpp @@ -8,7 +8,7 @@ #include "test_arithmetic.hpp" template -struct is_twos_complement_integer, ExpressionTemplates> > : public boost::mpl::false_ +struct is_twos_complement_integer, ExpressionTemplates> > : public std::integral_constant {}; template <> diff --git a/test/test_arithmetic_cpp_int_20.cpp b/test/test_arithmetic_cpp_int_20.cpp index 8e213341..e569f1ae 100644 --- a/test/test_arithmetic_cpp_int_20.cpp +++ b/test/test_arithmetic_cpp_int_20.cpp @@ -8,7 +8,7 @@ #include "test_arithmetic.hpp" template -struct is_twos_complement_integer, ExpressionTemplates> > : public boost::mpl::false_ +struct is_twos_complement_integer, ExpressionTemplates> > : public std::integral_constant {}; template <> diff --git a/test/test_arithmetic_cpp_int_3.cpp b/test/test_arithmetic_cpp_int_3.cpp index b2e48253..507e7e8e 100644 --- a/test/test_arithmetic_cpp_int_3.cpp +++ b/test/test_arithmetic_cpp_int_3.cpp @@ -8,7 +8,7 @@ #include "test_arithmetic.hpp" template -struct is_twos_complement_integer, ExpressionTemplates> > : public boost::mpl::false_ +struct is_twos_complement_integer, ExpressionTemplates> > : public std::integral_constant {}; template <> diff --git a/test/test_arithmetic_cpp_int_4.cpp b/test/test_arithmetic_cpp_int_4.cpp index 04487c41..55679add 100644 --- a/test/test_arithmetic_cpp_int_4.cpp +++ b/test/test_arithmetic_cpp_int_4.cpp @@ -10,7 +10,7 @@ #include "test_arithmetic.hpp" template -struct is_twos_complement_integer, ExpressionTemplates> > : public boost::mpl::false_ +struct is_twos_complement_integer, ExpressionTemplates> > : public std::integral_constant {}; template <> @@ -25,7 +25,7 @@ struct related_type -struct is_checked_cpp_int : public boost::mpl::true_ +struct is_checked_cpp_int : public std::integral_constant {}; int main() diff --git a/test/test_arithmetic_cpp_int_5.cpp b/test/test_arithmetic_cpp_int_5.cpp index 70ca66a1..310643f9 100644 --- a/test/test_arithmetic_cpp_int_5.cpp +++ b/test/test_arithmetic_cpp_int_5.cpp @@ -8,11 +8,11 @@ #include "test_arithmetic.hpp" template -struct is_checked_cpp_int, ET> > : public boost::mpl::true_ +struct is_checked_cpp_int, ET> > : public std::integral_constant {}; template -struct is_twos_complement_integer, ExpressionTemplates> > : public boost::mpl::false_ +struct is_twos_complement_integer, ExpressionTemplates> > : public std::integral_constant {}; template <> diff --git a/test/test_arithmetic_cpp_int_6.cpp b/test/test_arithmetic_cpp_int_6.cpp index 538ba803..90580156 100644 --- a/test/test_arithmetic_cpp_int_6.cpp +++ b/test/test_arithmetic_cpp_int_6.cpp @@ -8,7 +8,7 @@ #include "test_arithmetic.hpp" template -struct is_twos_complement_integer, ExpressionTemplates> > : public boost::mpl::false_ +struct is_twos_complement_integer, ExpressionTemplates> > : public std::integral_constant {}; template <> @@ -23,7 +23,7 @@ struct related_type -struct is_checked_cpp_int : public boost::mpl::true_ +struct is_checked_cpp_int : public std::integral_constant {}; int main() diff --git a/test/test_arithmetic_cpp_int_7.cpp b/test/test_arithmetic_cpp_int_7.cpp index 408f4c41..ea00d5d3 100644 --- a/test/test_arithmetic_cpp_int_7.cpp +++ b/test/test_arithmetic_cpp_int_7.cpp @@ -8,7 +8,7 @@ #include "test_arithmetic.hpp" template -struct is_twos_complement_integer, ExpressionTemplates> > : public boost::mpl::false_ +struct is_twos_complement_integer, ExpressionTemplates> > : public std::integral_constant {}; template <> diff --git a/test/test_arithmetic_cpp_int_8.cpp b/test/test_arithmetic_cpp_int_8.cpp index 89a3d9bd..5342f0fc 100644 --- a/test/test_arithmetic_cpp_int_8.cpp +++ b/test/test_arithmetic_cpp_int_8.cpp @@ -8,7 +8,7 @@ #include "test_arithmetic.hpp" template -struct is_twos_complement_integer, ExpressionTemplates> > : public boost::mpl::false_ +struct is_twos_complement_integer, ExpressionTemplates> > : public std::integral_constant {}; template <> diff --git a/test/test_arithmetic_cpp_int_9.cpp b/test/test_arithmetic_cpp_int_9.cpp index 41aae94f..dd2a027a 100644 --- a/test/test_arithmetic_cpp_int_9.cpp +++ b/test/test_arithmetic_cpp_int_9.cpp @@ -8,7 +8,7 @@ #include "test_arithmetic.hpp" template -struct is_twos_complement_integer, ExpressionTemplates> > : public boost::mpl::false_ +struct is_twos_complement_integer, ExpressionTemplates> > : public std::integral_constant {}; template <> diff --git a/test/test_arithmetic_cpp_int_br.cpp b/test/test_arithmetic_cpp_int_br.cpp index 59a5e41e..601f6565 100644 --- a/test/test_arithmetic_cpp_int_br.cpp +++ b/test/test_arithmetic_cpp_int_br.cpp @@ -10,7 +10,7 @@ #include "test_arithmetic.hpp" template -struct is_twos_complement_integer, ExpressionTemplates> > : public boost::mpl::false_ +struct is_twos_complement_integer, ExpressionTemplates> > : public std::integral_constant {}; template <> diff --git a/test/test_arithmetic_mpz_br.cpp b/test/test_arithmetic_mpz_br.cpp index 44df14d6..c109a49a 100644 --- a/test/test_arithmetic_mpz_br.cpp +++ b/test/test_arithmetic_mpz_br.cpp @@ -16,13 +16,13 @@ #include template -struct is_boost_rational > : public boost::mpl::true_ +struct is_boost_rational > : public std::integral_constant {}; namespace boost { namespace multiprecision { template <> -struct number_category > : public mpl::int_ +struct number_category > : public std::integral_constant {}; }} // namespace boost::multiprecision diff --git a/test/test_arithmetic_tommath.cpp b/test/test_arithmetic_tommath.cpp index 904d1564..b2a68149 100644 --- a/test/test_arithmetic_tommath.cpp +++ b/test/test_arithmetic_tommath.cpp @@ -12,7 +12,7 @@ #include "test_arithmetic.hpp" template <> -struct is_twos_complement_integer : public boost::mpl::false_ +struct is_twos_complement_integer : public std::integral_constant {}; int main() diff --git a/test/test_arithmetic_tommath_br.cpp b/test/test_arithmetic_tommath_br.cpp index bf6913c2..03227c7b 100644 --- a/test/test_arithmetic_tommath_br.cpp +++ b/test/test_arithmetic_tommath_br.cpp @@ -17,13 +17,13 @@ #include template -struct is_boost_rational > : public boost::mpl::true_ +struct is_boost_rational > : public std::integral_constant {}; namespace boost { namespace multiprecision { template <> -struct number_category > : public mpl::int_ +struct number_category > : public std::integral_constant {}; }} // namespace boost::multiprecision diff --git a/test/test_arithmetic_tommath_rat.cpp b/test/test_arithmetic_tommath_rat.cpp index 4f042fce..4c136c6a 100644 --- a/test/test_arithmetic_tommath_rat.cpp +++ b/test/test_arithmetic_tommath_rat.cpp @@ -12,7 +12,7 @@ #include "test_arithmetic.hpp" template <> -struct is_twos_complement_integer : public boost::mpl::false_ +struct is_twos_complement_integer : public std::integral_constant {}; int main() diff --git a/test/test_atan.cpp b/test/test_atan.cpp index a1c2cbc2..c0986bb2 100644 --- a/test/test_atan.cpp +++ b/test/test_atan.cpp @@ -74,12 +74,12 @@ T atan2_def(T y, T x) } template -struct is_mpfr_type : public boost::mpl::false_ +struct is_mpfr_type : public std::integral_constant {}; #ifdef TEST_MPFR_50 template -struct is_mpfr_type > > : public boost::mpl::true_ +struct is_mpfr_type > > : public std::integral_constant {}; #endif diff --git a/test/test_checked_cpp_int.cpp b/test/test_checked_cpp_int.cpp index 99a522d1..27df44b3 100644 --- a/test/test_checked_cpp_int.cpp +++ b/test/test_checked_cpp_int.cpp @@ -52,7 +52,7 @@ T generate_random(unsigned bits_wanted) } template -void test_signed_overflow(Number a, Number b, const boost::mpl::true_&) +void test_signed_overflow(Number a, Number b, const std::integral_constant&) { a = -a; BOOST_CHECK_THROW(Number(a * b), std::overflow_error); @@ -60,7 +60,7 @@ void test_signed_overflow(Number a, Number b, const boost::mpl::true_&) BOOST_CHECK(Number(a * b) >= (std::numeric_limits::min)()); } template -void test_signed_overflow(Number, Number, const boost::mpl::false_&) +void test_signed_overflow(Number, Number, const std::integral_constant&) { } @@ -112,7 +112,7 @@ void test() val = static_cast(generate_random(bits)); test_type val2 = 1 + (std::numeric_limits::max)() / val; BOOST_CHECK_THROW(test_type(val2 * val), std::overflow_error); - test_signed_overflow(val2, val, boost::mpl::bool_::is_signed>()); + test_signed_overflow(val2, val, std::integral_constant::is_signed>()); --val2; BOOST_CHECK(cpp_int(val2) * cpp_int(val) <= cpp_int((std::numeric_limits::max)())); BOOST_CHECK(val2 * val <= (std::numeric_limits::max)()); diff --git a/test/test_convert_from_cpp_bin_float.cpp b/test/test_convert_from_cpp_bin_float.cpp index 1a365162..35ed3dad 100644 --- a/test/test_convert_from_cpp_bin_float.cpp +++ b/test/test_convert_from_cpp_bin_float.cpp @@ -70,7 +70,7 @@ T generate_random() } template -void test_convert_neg_int(From from, const boost::mpl::true_&) +void test_convert_neg_int(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -79,12 +79,12 @@ void test_convert_neg_int(From from, const boost::mpl::true_&) BOOST_CHECK_EQUAL(From(trunc(from)), From(t4)); } template -void test_convert_neg_int(From const&, const boost::mpl::false_&) +void test_convert_neg_int(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { for (unsigned i = 0; i < 100; ++i) { @@ -93,12 +93,12 @@ void test_convert_imp(boost::mpl::int_ const&, boost To t2 = from.template convert_to(); BOOST_CHECK_EQUAL(From(trunc(from)), From(t1)); BOOST_CHECK_EQUAL(From(trunc(from)), From(t2)); - test_convert_neg_int(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_int(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } template -void test_convert_neg_rat(From from, const boost::mpl::true_&) +void test_convert_neg_rat(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -107,12 +107,12 @@ void test_convert_neg_rat(From from, const boost::mpl::true_&) BOOST_CHECK_EQUAL(From(t4), from); } template -void test_convert_rat_int(From const&, const boost::mpl::false_&) +void test_convert_rat_int(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { for (unsigned i = 0; i < 100; ++i) { @@ -121,12 +121,12 @@ void test_convert_imp(boost::mpl::int_ const&, boost To t2 = from.template convert_to(); BOOST_CHECK_EQUAL(From(t1), from); BOOST_CHECK_EQUAL(From(t2), from); - test_convert_neg_rat(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_rat(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } template -void test_convert_neg_float(From from, const boost::mpl::true_&) +void test_convert_neg_float(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -137,12 +137,12 @@ void test_convert_neg_float(From from, const boost::mpl::true_&) BOOST_CHECK_CLOSE_FRACTION(t4, answer, tol); } template -void test_convert_neg_float(From const&, const boost::mpl::false_&) +void test_convert_neg_float(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { for (unsigned i = 0; i < 100; ++i) { @@ -153,7 +153,7 @@ void test_convert_imp(boost::mpl::int_ const&, boost To tol = (std::max)(std::numeric_limits::epsilon(), To(std::numeric_limits::epsilon())) * 2; BOOST_CHECK_CLOSE_FRACTION(t1, answer, tol); BOOST_CHECK_CLOSE_FRACTION(t2, answer, tol); - test_convert_neg_float(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_float(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } diff --git a/test/test_convert_from_cpp_dec_float.cpp b/test/test_convert_from_cpp_dec_float.cpp index fd599a1e..02db3b58 100644 --- a/test/test_convert_from_cpp_dec_float.cpp +++ b/test/test_convert_from_cpp_dec_float.cpp @@ -57,7 +57,7 @@ T generate_random() } template -void test_convert_neg_int(From from, const boost::mpl::true_&) +void test_convert_neg_int(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -66,12 +66,12 @@ void test_convert_neg_int(From from, const boost::mpl::true_&) BOOST_CHECK_EQUAL(From(trunc(from)), From(t4)); } template -void test_convert_neg_int(From const&, const boost::mpl::false_&) +void test_convert_neg_int(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { for (unsigned i = 0; i < 100; ++i) { @@ -80,12 +80,12 @@ void test_convert_imp(boost::mpl::int_ const&, boost To t2 = from.template convert_to(); BOOST_CHECK_EQUAL(From(trunc(from)), From(t1)); BOOST_CHECK_EQUAL(From(trunc(from)), From(t2)); - test_convert_neg_int(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_int(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } template -void test_convert_neg_rat(From from, const boost::mpl::true_&) +void test_convert_neg_rat(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -95,12 +95,12 @@ void test_convert_neg_rat(From from, const boost::mpl::true_&) BOOST_CHECK_CLOSE_FRACTION(From(t4), from, tol); } template -void test_convert_rat_int(From const&, const boost::mpl::false_&) +void test_convert_rat_int(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { for (unsigned i = 0; i < 100; ++i) { @@ -110,12 +110,12 @@ void test_convert_imp(boost::mpl::int_ const&, boost From tol = std::numeric_limits::epsilon(); BOOST_CHECK_CLOSE_FRACTION(From(t1), from, tol); BOOST_CHECK_CLOSE_FRACTION(From(t2), from, tol); - test_convert_neg_rat(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_rat(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } template -void test_convert_neg_float(From from, const boost::mpl::true_&) +void test_convert_neg_float(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -126,12 +126,12 @@ void test_convert_neg_float(From from, const boost::mpl::true_&) BOOST_CHECK_CLOSE_FRACTION(t4, answer, tol); } template -void test_convert_neg_float(From const&, const boost::mpl::false_&) +void test_convert_neg_float(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { for (unsigned i = 0; i < 100; ++i) { @@ -142,7 +142,7 @@ void test_convert_imp(boost::mpl::int_ const&, boost To tol = (std::max)(std::numeric_limits::epsilon(), To(std::numeric_limits::epsilon())) * 2; BOOST_CHECK_CLOSE_FRACTION(t1, answer, tol); BOOST_CHECK_CLOSE_FRACTION(t2, answer, tol); - test_convert_neg_float(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_float(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } diff --git a/test/test_convert_from_cpp_int.cpp b/test/test_convert_from_cpp_int.cpp index 63dfdd7b..9c03b934 100644 --- a/test/test_convert_from_cpp_int.cpp +++ b/test/test_convert_from_cpp_int.cpp @@ -71,7 +71,7 @@ T generate_random(unsigned bits_wanted) } template -void test_convert_neg_int(From from, const boost::mpl::true_&) +void test_convert_neg_int(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -80,12 +80,12 @@ void test_convert_neg_int(From from, const boost::mpl::true_&) BOOST_CHECK_EQUAL(from.str(), t4.str()); } template -void test_convert_neg_int(From const&, const boost::mpl::false_&) +void test_convert_neg_int(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { int bits_wanted = (std::min)((std::min)(std::numeric_limits::digits, std::numeric_limits::digits), 2000); @@ -96,12 +96,12 @@ void test_convert_imp(boost::mpl::int_ const&, boost::mpl:: To t2 = from.template convert_to(); BOOST_CHECK_EQUAL(from.str(), t1.str()); BOOST_CHECK_EQUAL(from.str(), t2.str()); - test_convert_neg_int(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_int(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } template -void test_convert_neg_rat(From from, const boost::mpl::true_&) +void test_convert_neg_rat(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -110,12 +110,12 @@ void test_convert_neg_rat(From from, const boost::mpl::true_&) BOOST_CHECK_EQUAL(from.str(), numerator(t4).str()); } template -void test_convert_neg_rat(From const&, const boost::mpl::false_&) +void test_convert_neg_rat(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { int bits_wanted = (std::min)((std::min)(std::numeric_limits::digits, std::numeric_limits::digits), 2000); @@ -126,12 +126,12 @@ void test_convert_imp(boost::mpl::int_ const&, boost::mpl:: To t2 = from.template convert_to(); BOOST_CHECK_EQUAL(from.str(), numerator(t1).str()); BOOST_CHECK_EQUAL(from.str(), numerator(t2).str()); - test_convert_neg_rat(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_rat(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } template -void test_convert_neg_float(From from, const boost::mpl::true_&) +void test_convert_neg_float(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -141,12 +141,12 @@ void test_convert_neg_float(From from, const boost::mpl::true_&) BOOST_CHECK_EQUAL(t4, check); } template -void test_convert_neg_float(From const&, const boost::mpl::false_&) +void test_convert_neg_float(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { int bits_wanted = (std::min)((std::min)(std::numeric_limits::digits, std::numeric_limits::digits), 2000); @@ -158,7 +158,7 @@ void test_convert_imp(boost::mpl::int_ const&, boost::mpl:: To check(from.str() + ".0"); BOOST_CHECK_EQUAL(t1, check); BOOST_CHECK_EQUAL(t2, check); - test_convert_neg_float(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_float(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } diff --git a/test/test_convert_from_cpp_rational.cpp b/test/test_convert_from_cpp_rational.cpp index 16b89996..23c8334b 100644 --- a/test/test_convert_from_cpp_rational.cpp +++ b/test/test_convert_from_cpp_rational.cpp @@ -79,7 +79,7 @@ T generate_random(unsigned bits_wanted) } template -void test_convert_neg_val(From from, const boost::mpl::true_&) +void test_convert_neg_val(From from, const std::integral_constant&) { from = -from; typename component_type::type answer = numerator(from) / denominator(from); @@ -89,12 +89,12 @@ void test_convert_neg_val(From from, const boost::mpl::true_&) BOOST_CHECK_EQUAL(answer.str(), t4.str()); } template -void test_convert_neg_val(From const&, const boost::mpl::false_&) +void test_convert_neg_val(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { int bits_wanted = (std::min)((std::min)(std::numeric_limits::digits, std::numeric_limits::digits), 2000); @@ -106,12 +106,12 @@ void test_convert_imp(boost::mpl::int_ const&, boost::mpl: To t2 = from.template convert_to(); BOOST_CHECK_EQUAL(answer.str(), t1.str()); BOOST_CHECK_EQUAL(answer.str(), t2.str()); - test_convert_neg_val(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_val(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } template -void test_convert_neg_float_val(From from, To const& tol, const boost::mpl::true_&) +void test_convert_neg_float_val(From from, To const& tol, const std::integral_constant&) { from = -from; To answer = To(numerator(from)) / To(denominator(from)); @@ -121,12 +121,12 @@ void test_convert_neg_float_val(From from, To const& tol, const boost::mpl::true BOOST_CHECK_CLOSE_FRACTION(answer, t4, tol); } template -void test_convert_neg_float_val(From const&, To const&, const boost::mpl::false_&) +void test_convert_neg_float_val(From const&, To const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { int bits_wanted = (std::min)((std::min)(std::numeric_limits::digits, std::numeric_limits::digits), 2000); @@ -140,12 +140,12 @@ void test_convert_imp(boost::mpl::int_ const&, boost::mpl: tol *= 2; BOOST_CHECK_CLOSE_FRACTION(answer, t1, tol); BOOST_CHECK_CLOSE_FRACTION(answer, t2, tol); - test_convert_neg_float_val(from, tol, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_float_val(from, tol, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } template -void test_convert_neg_rat_val(From from, const boost::mpl::true_&) +void test_convert_neg_rat_val(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -154,12 +154,12 @@ void test_convert_neg_rat_val(From from, const boost::mpl::true_&) BOOST_CHECK_EQUAL(from.str(), t4.str()); } template -void test_convert_neg_rat_val(From const&, const boost::mpl::false_&) +void test_convert_neg_rat_val(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { int bits_wanted = (std::min)((std::min)(std::numeric_limits::digits, std::numeric_limits::digits), 2000); @@ -170,7 +170,7 @@ void test_convert_imp(boost::mpl::int_ const&, boost::mpl: To t2 = from.template convert_to(); BOOST_CHECK_EQUAL(from.str(), t1.str()); BOOST_CHECK_EQUAL(from.str(), t2.str()); - test_convert_neg_rat_val(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_rat_val(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } diff --git a/test/test_convert_from_float128.cpp b/test/test_convert_from_float128.cpp index bbe250d4..00bd4449 100644 --- a/test/test_convert_from_float128.cpp +++ b/test/test_convert_from_float128.cpp @@ -59,7 +59,7 @@ T generate_random() } template -void test_convert_neg_int(From from, const boost::mpl::true_&) +void test_convert_neg_int(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -68,12 +68,12 @@ void test_convert_neg_int(From from, const boost::mpl::true_&) BOOST_CHECK_EQUAL(From(trunc(from)), From(t4)); } template -void test_convert_neg_int(From const&, const boost::mpl::false_&) +void test_convert_neg_int(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { for (unsigned i = 0; i < 100; ++i) { @@ -82,12 +82,12 @@ void test_convert_imp(boost::mpl::int_ const&, boost To t2 = from.template convert_to(); BOOST_CHECK_EQUAL(From(trunc(from)), From(t1)); BOOST_CHECK_EQUAL(From(trunc(from)), From(t2)); - test_convert_neg_int(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_int(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } template -void test_convert_neg_rat(From from, const boost::mpl::true_&) +void test_convert_neg_rat(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -96,12 +96,12 @@ void test_convert_neg_rat(From from, const boost::mpl::true_&) BOOST_CHECK_EQUAL(From(t4), from); } template -void test_convert_rat_int(From const&, const boost::mpl::false_&) +void test_convert_rat_int(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { for (unsigned i = 0; i < 100; ++i) { @@ -110,12 +110,12 @@ void test_convert_imp(boost::mpl::int_ const&, boost To t2 = from.template convert_to(); BOOST_CHECK_EQUAL(From(t1), from); BOOST_CHECK_EQUAL(From(t2), from); - test_convert_neg_rat(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_rat(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } template -void test_convert_neg_float(From from, const boost::mpl::true_&) +void test_convert_neg_float(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -126,12 +126,12 @@ void test_convert_neg_float(From from, const boost::mpl::true_&) BOOST_CHECK_CLOSE_FRACTION(t4, answer, tol); } template -void test_convert_neg_float(From const&, const boost::mpl::false_&) +void test_convert_neg_float(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { for (unsigned i = 0; i < 100; ++i) { @@ -142,7 +142,7 @@ void test_convert_imp(boost::mpl::int_ const&, boost To tol = (std::max)(std::numeric_limits::epsilon(), To(std::numeric_limits::epsilon())) * 2; BOOST_CHECK_CLOSE_FRACTION(t1, answer, tol); BOOST_CHECK_CLOSE_FRACTION(t2, answer, tol); - test_convert_neg_float(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_float(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } diff --git a/test/test_convert_from_gmp_rational.cpp b/test/test_convert_from_gmp_rational.cpp index 8b2c9ebb..07b97dab 100644 --- a/test/test_convert_from_gmp_rational.cpp +++ b/test/test_convert_from_gmp_rational.cpp @@ -79,7 +79,7 @@ T generate_random(unsigned bits_wanted) } template -void test_convert_neg_val(From from, const boost::mpl::true_&) +void test_convert_neg_val(From from, const std::integral_constant&) { from = -from; typename component_type::type answer = numerator(from) / denominator(from); @@ -89,12 +89,12 @@ void test_convert_neg_val(From from, const boost::mpl::true_&) BOOST_CHECK_EQUAL(answer.str(), t4.str()); } template -void test_convert_neg_val(From const&, const boost::mpl::false_&) +void test_convert_neg_val(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { int bits_wanted = (std::min)((std::min)(std::numeric_limits::digits, std::numeric_limits::digits), 2000); @@ -106,12 +106,12 @@ void test_convert_imp(boost::mpl::int_ const&, boost::mpl: To t2 = from.template convert_to(); BOOST_CHECK_EQUAL(answer.str(), t1.str()); BOOST_CHECK_EQUAL(answer.str(), t2.str()); - test_convert_neg_val(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_val(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } template -void test_convert_neg_float_val(From from, To const& tol, const boost::mpl::true_&) +void test_convert_neg_float_val(From from, To const& tol, const std::integral_constant&) { from = -from; To answer = To(numerator(from)) / To(denominator(from)); @@ -121,12 +121,12 @@ void test_convert_neg_float_val(From from, To const& tol, const boost::mpl::true BOOST_CHECK_CLOSE_FRACTION(answer, t4, tol); } template -void test_convert_neg_float_val(From const&, To const&, const boost::mpl::false_&) +void test_convert_neg_float_val(From const&, To const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { int bits_wanted = (std::min)((std::min)(std::numeric_limits::digits, std::numeric_limits::digits), 2000); @@ -140,12 +140,12 @@ void test_convert_imp(boost::mpl::int_ const&, boost::mpl: tol *= 2; BOOST_CHECK_CLOSE_FRACTION(answer, t1, tol); BOOST_CHECK_CLOSE_FRACTION(answer, t2, tol); - test_convert_neg_float_val(from, tol, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_float_val(from, tol, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } template -void test_convert_neg_rat_val(From from, const boost::mpl::true_&) +void test_convert_neg_rat_val(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -154,12 +154,12 @@ void test_convert_neg_rat_val(From from, const boost::mpl::true_&) BOOST_CHECK_EQUAL(from.str(), t4.str()); } template -void test_convert_neg_rat_val(From const&, const boost::mpl::false_&) +void test_convert_neg_rat_val(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { int bits_wanted = (std::min)((std::min)(std::numeric_limits::digits, std::numeric_limits::digits), 2000); @@ -170,7 +170,7 @@ void test_convert_imp(boost::mpl::int_ const&, boost::mpl: To t2 = from.template convert_to(); BOOST_CHECK_EQUAL(from.str(), t1.str()); BOOST_CHECK_EQUAL(from.str(), t2.str()); - test_convert_neg_rat_val(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_rat_val(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } diff --git a/test/test_convert_from_mpf_float.cpp b/test/test_convert_from_mpf_float.cpp index f898bfbe..7ff08e76 100644 --- a/test/test_convert_from_mpf_float.cpp +++ b/test/test_convert_from_mpf_float.cpp @@ -59,7 +59,7 @@ T generate_random() } template -void test_convert_neg_int(From from, const boost::mpl::true_&) +void test_convert_neg_int(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -68,12 +68,12 @@ void test_convert_neg_int(From from, const boost::mpl::true_&) BOOST_CHECK_EQUAL(From(trunc(from)), From(t4)); } template -void test_convert_neg_int(From const&, const boost::mpl::false_&) +void test_convert_neg_int(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { for (unsigned i = 0; i < 100; ++i) { @@ -82,12 +82,12 @@ void test_convert_imp(boost::mpl::int_ const&, boost To t2 = from.template convert_to(); BOOST_CHECK_EQUAL(From(trunc(from)), From(t1)); BOOST_CHECK_EQUAL(From(trunc(from)), From(t2)); - test_convert_neg_int(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_int(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } template -void test_convert_neg_rat(From from, const boost::mpl::true_&) +void test_convert_neg_rat(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -97,12 +97,12 @@ void test_convert_neg_rat(From from, const boost::mpl::true_&) BOOST_CHECK_CLOSE_FRACTION(From(t4), from, tol); } template -void test_convert_rat_int(From const&, const boost::mpl::false_&) +void test_convert_rat_int(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { for (unsigned i = 0; i < 100; ++i) { @@ -112,12 +112,12 @@ void test_convert_imp(boost::mpl::int_ const&, boost From tol = std::numeric_limits::epsilon(); BOOST_CHECK_CLOSE_FRACTION(From(t1), from, tol); BOOST_CHECK_CLOSE_FRACTION(From(t2), from, tol); - test_convert_neg_rat(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_rat(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } template -void test_convert_neg_float(From from, const boost::mpl::true_&) +void test_convert_neg_float(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -128,12 +128,12 @@ void test_convert_neg_float(From from, const boost::mpl::true_&) BOOST_CHECK_CLOSE_FRACTION(t4, answer, tol); } template -void test_convert_neg_float(From const&, const boost::mpl::false_&) +void test_convert_neg_float(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { for (unsigned i = 0; i < 100; ++i) { @@ -144,7 +144,7 @@ void test_convert_imp(boost::mpl::int_ const&, boost To tol = (std::max)(std::numeric_limits::epsilon(), To(std::numeric_limits::epsilon())) * 2; BOOST_CHECK_CLOSE_FRACTION(t1, answer, tol); BOOST_CHECK_CLOSE_FRACTION(t2, answer, tol); - test_convert_neg_float(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_float(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } diff --git a/test/test_convert_from_mpfi_float.cpp b/test/test_convert_from_mpfi_float.cpp index b7a24585..9d0e06ea 100644 --- a/test/test_convert_from_mpfi_float.cpp +++ b/test/test_convert_from_mpfi_float.cpp @@ -61,7 +61,7 @@ T generate_random() } template -void test_convert_neg_int(From from, const boost::mpl::true_&) +void test_convert_neg_int(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -70,12 +70,12 @@ void test_convert_neg_int(From from, const boost::mpl::true_&) BOOST_CHECK_EQUAL(From(trunc(from)), From(t4)); } template -void test_convert_neg_int(From const&, const boost::mpl::false_&) +void test_convert_neg_int(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { for (unsigned i = 0; i < 100; ++i) { @@ -84,12 +84,12 @@ void test_convert_imp(boost::mpl::int_ const&, boost To t2 = from.template convert_to(); BOOST_CHECK_EQUAL(From(trunc(from)), From(t1)); BOOST_CHECK_EQUAL(From(trunc(from)), From(t2)); - test_convert_neg_int(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_int(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } template -void test_convert_neg_rat(From from, const boost::mpl::true_&) +void test_convert_neg_rat(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -98,12 +98,12 @@ void test_convert_neg_rat(From from, const boost::mpl::true_&) BOOST_CHECK_EQUAL(From(t4), median(from)); } template -void test_convert_rat_int(From const&, const boost::mpl::false_&) +void test_convert_rat_int(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { for (unsigned i = 0; i < 100; ++i) { @@ -112,12 +112,12 @@ void test_convert_imp(boost::mpl::int_ const&, boost To t2 = from.template convert_to(); BOOST_CHECK_EQUAL(From(t1), median(from)); BOOST_CHECK_EQUAL(From(t2), median(from)); - test_convert_neg_rat(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_rat(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } template -void test_convert_neg_float(From from, const boost::mpl::true_&) +void test_convert_neg_float(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -128,12 +128,12 @@ void test_convert_neg_float(From from, const boost::mpl::true_&) BOOST_CHECK_CLOSE_FRACTION(t4, answer, tol); } template -void test_convert_neg_float(From const&, const boost::mpl::false_&) +void test_convert_neg_float(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { for (unsigned i = 0; i < 100; ++i) { @@ -144,7 +144,7 @@ void test_convert_imp(boost::mpl::int_ const&, boost To tol = (std::max)(std::numeric_limits::epsilon(), To(std::numeric_limits::epsilon())) * 2; BOOST_CHECK_CLOSE_FRACTION(t1, answer, tol); BOOST_CHECK_CLOSE_FRACTION(t2, answer, tol); - test_convert_neg_float(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_float(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } diff --git a/test/test_convert_from_mpfr_float.cpp b/test/test_convert_from_mpfr_float.cpp index 216afaad..590773ca 100644 --- a/test/test_convert_from_mpfr_float.cpp +++ b/test/test_convert_from_mpfr_float.cpp @@ -59,7 +59,7 @@ T generate_random() } template -void test_convert_neg_int(From from, const boost::mpl::true_&) +void test_convert_neg_int(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -68,12 +68,12 @@ void test_convert_neg_int(From from, const boost::mpl::true_&) BOOST_CHECK_EQUAL(From(trunc(from)), From(t4)); } template -void test_convert_neg_int(From const&, const boost::mpl::false_&) +void test_convert_neg_int(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { for (unsigned i = 0; i < 100; ++i) { @@ -82,12 +82,12 @@ void test_convert_imp(boost::mpl::int_ const&, boost To t2 = from.template convert_to(); BOOST_CHECK_EQUAL(From(trunc(from)), From(t1)); BOOST_CHECK_EQUAL(From(trunc(from)), From(t2)); - test_convert_neg_int(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_int(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } template -void test_convert_neg_rat(From from, const boost::mpl::true_&) +void test_convert_neg_rat(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -96,12 +96,12 @@ void test_convert_neg_rat(From from, const boost::mpl::true_&) BOOST_CHECK_EQUAL(From(t4), from); } template -void test_convert_rat_int(From const&, const boost::mpl::false_&) +void test_convert_rat_int(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { for (unsigned i = 0; i < 100; ++i) { @@ -110,12 +110,12 @@ void test_convert_imp(boost::mpl::int_ const&, boost To t2 = from.template convert_to(); BOOST_CHECK_EQUAL(From(t1), from); BOOST_CHECK_EQUAL(From(t2), from); - test_convert_neg_rat(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_rat(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } template -void test_convert_neg_float(From from, const boost::mpl::true_&) +void test_convert_neg_float(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -126,12 +126,12 @@ void test_convert_neg_float(From from, const boost::mpl::true_&) BOOST_CHECK_CLOSE_FRACTION(t4, answer, tol); } template -void test_convert_neg_float(From const&, const boost::mpl::false_&) +void test_convert_neg_float(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { for (unsigned i = 0; i < 100; ++i) { @@ -142,7 +142,7 @@ void test_convert_imp(boost::mpl::int_ const&, boost To tol = (std::max)(std::numeric_limits::epsilon(), To(std::numeric_limits::epsilon())) * 2; BOOST_CHECK_CLOSE_FRACTION(t1, answer, tol); BOOST_CHECK_CLOSE_FRACTION(t2, answer, tol); - test_convert_neg_float(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_float(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } diff --git a/test/test_convert_from_mpz_int.cpp b/test/test_convert_from_mpz_int.cpp index d1c74344..ca70acfc 100644 --- a/test/test_convert_from_mpz_int.cpp +++ b/test/test_convert_from_mpz_int.cpp @@ -71,7 +71,7 @@ T generate_random(unsigned bits_wanted) } template -void test_convert_neg_int(From from, const boost::mpl::true_&) +void test_convert_neg_int(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -80,12 +80,12 @@ void test_convert_neg_int(From from, const boost::mpl::true_&) BOOST_CHECK_EQUAL(from.str(), t4.str()); } template -void test_convert_neg_int(From const&, const boost::mpl::false_&) +void test_convert_neg_int(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { int bits_wanted = (std::min)((std::min)(std::numeric_limits::digits, std::numeric_limits::digits), 2000); @@ -96,12 +96,12 @@ void test_convert_imp(boost::mpl::int_ const&, boost::mpl:: To t2 = from.template convert_to(); BOOST_CHECK_EQUAL(from.str(), t1.str()); BOOST_CHECK_EQUAL(from.str(), t2.str()); - test_convert_neg_int(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_int(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } template -void test_convert_neg_rat(From from, const boost::mpl::true_&) +void test_convert_neg_rat(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -110,12 +110,12 @@ void test_convert_neg_rat(From from, const boost::mpl::true_&) BOOST_CHECK_EQUAL(from.str(), numerator(t4).str()); } template -void test_convert_neg_rat(From const&, const boost::mpl::false_&) +void test_convert_neg_rat(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { int bits_wanted = (std::min)((std::min)(std::numeric_limits::digits, std::numeric_limits::digits), 2000); @@ -126,12 +126,12 @@ void test_convert_imp(boost::mpl::int_ const&, boost::mpl:: To t2 = from.template convert_to(); BOOST_CHECK_EQUAL(from.str(), numerator(t1).str()); BOOST_CHECK_EQUAL(from.str(), numerator(t2).str()); - test_convert_neg_rat(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_rat(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } template -void test_convert_neg_float(From from, const boost::mpl::true_&) +void test_convert_neg_float(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -141,12 +141,12 @@ void test_convert_neg_float(From from, const boost::mpl::true_&) BOOST_CHECK_EQUAL(t4, check); } template -void test_convert_neg_float(From const&, const boost::mpl::false_&) +void test_convert_neg_float(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { int bits_wanted = (std::min)((std::min)(std::numeric_limits::digits, std::numeric_limits::digits), 2000); @@ -158,7 +158,7 @@ void test_convert_imp(boost::mpl::int_ const&, boost::mpl:: To check(from.str() + ".0"); BOOST_CHECK_EQUAL(t1, check); BOOST_CHECK_EQUAL(t2, check); - test_convert_neg_float(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_float(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } diff --git a/test/test_convert_from_tom_int.cpp b/test/test_convert_from_tom_int.cpp index e13b3e04..666d9b62 100644 --- a/test/test_convert_from_tom_int.cpp +++ b/test/test_convert_from_tom_int.cpp @@ -71,7 +71,7 @@ T generate_random(unsigned bits_wanted) } template -void test_convert_neg_int(From from, const boost::mpl::true_&) +void test_convert_neg_int(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -80,12 +80,12 @@ void test_convert_neg_int(From from, const boost::mpl::true_&) BOOST_CHECK_EQUAL(from.str(), t4.str()); } template -void test_convert_neg_int(From const&, const boost::mpl::false_&) +void test_convert_neg_int(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { int bits_wanted = (std::min)((std::min)(std::numeric_limits::digits, std::numeric_limits::digits), 2000); @@ -96,12 +96,12 @@ void test_convert_imp(boost::mpl::int_ const&, boost::mpl:: To t2 = from.template convert_to(); BOOST_CHECK_EQUAL(from.str(), t1.str()); BOOST_CHECK_EQUAL(from.str(), t2.str()); - test_convert_neg_int(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_int(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } template -void test_convert_neg_rat(From from, const boost::mpl::true_&) +void test_convert_neg_rat(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -110,12 +110,12 @@ void test_convert_neg_rat(From from, const boost::mpl::true_&) BOOST_CHECK_EQUAL(from.str(), numerator(t4).str()); } template -void test_convert_neg_rat(From const&, const boost::mpl::false_&) +void test_convert_neg_rat(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { int bits_wanted = (std::min)((std::min)(std::numeric_limits::digits, std::numeric_limits::digits), 2000); @@ -126,12 +126,12 @@ void test_convert_imp(boost::mpl::int_ const&, boost::mpl:: To t2 = from.template convert_to(); BOOST_CHECK_EQUAL(from.str(), numerator(t1).str()); BOOST_CHECK_EQUAL(from.str(), numerator(t2).str()); - test_convert_neg_rat(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_rat(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } template -void test_convert_neg_float(From from, const boost::mpl::true_&) +void test_convert_neg_float(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -141,12 +141,12 @@ void test_convert_neg_float(From from, const boost::mpl::true_&) BOOST_CHECK_EQUAL(t4, check); } template -void test_convert_neg_float(From const&, const boost::mpl::false_&) +void test_convert_neg_float(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { int bits_wanted = (std::min)((std::min)(std::numeric_limits::digits, std::numeric_limits::digits), 2000); @@ -158,7 +158,7 @@ void test_convert_imp(boost::mpl::int_ const&, boost::mpl:: To check(from.str() + ".0"); BOOST_CHECK_EQUAL(t1, check); BOOST_CHECK_EQUAL(t2, check); - test_convert_neg_float(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_float(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } diff --git a/test/test_convert_from_tom_rational.cpp b/test/test_convert_from_tom_rational.cpp index 3b1432e5..74ce54e9 100644 --- a/test/test_convert_from_tom_rational.cpp +++ b/test/test_convert_from_tom_rational.cpp @@ -79,7 +79,7 @@ T generate_random(unsigned bits_wanted) } template -void test_convert_neg_val(From from, const boost::mpl::true_&) +void test_convert_neg_val(From from, const std::integral_constant&) { from = -from; typename component_type::type answer = numerator(from) / denominator(from); @@ -89,12 +89,12 @@ void test_convert_neg_val(From from, const boost::mpl::true_&) BOOST_CHECK_EQUAL(answer.str(), t4.str()); } template -void test_convert_neg_val(From const&, const boost::mpl::false_&) +void test_convert_neg_val(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { int bits_wanted = (std::min)((std::min)(std::numeric_limits::digits, std::numeric_limits::digits), 2000); @@ -106,12 +106,12 @@ void test_convert_imp(boost::mpl::int_ const&, boost::mpl: To t2 = from.template convert_to(); BOOST_CHECK_EQUAL(answer.str(), t1.str()); BOOST_CHECK_EQUAL(answer.str(), t2.str()); - test_convert_neg_val(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_val(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } template -void test_convert_neg_float_val(From from, To const& tol, const boost::mpl::true_&) +void test_convert_neg_float_val(From from, To const& tol, const std::integral_constant&) { from = -from; To answer = To(numerator(from)) / To(denominator(from)); @@ -121,12 +121,12 @@ void test_convert_neg_float_val(From from, To const& tol, const boost::mpl::true BOOST_CHECK_CLOSE_FRACTION(answer, t4, tol); } template -void test_convert_neg_float_val(From const&, To const&, const boost::mpl::false_&) +void test_convert_neg_float_val(From const&, To const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { int bits_wanted = (std::min)((std::min)(std::numeric_limits::digits, std::numeric_limits::digits), 2000); @@ -140,12 +140,12 @@ void test_convert_imp(boost::mpl::int_ const&, boost::mpl: tol *= 2; BOOST_CHECK_CLOSE_FRACTION(answer, t1, tol); BOOST_CHECK_CLOSE_FRACTION(answer, t2, tol); - test_convert_neg_float_val(from, tol, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_float_val(from, tol, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } template -void test_convert_neg_rat_val(From from, const boost::mpl::true_&) +void test_convert_neg_rat_val(From from, const std::integral_constant&) { from = -from; To t3(from); @@ -154,12 +154,12 @@ void test_convert_neg_rat_val(From from, const boost::mpl::true_&) BOOST_CHECK_EQUAL(from.str(), t4.str()); } template -void test_convert_neg_rat_val(From const&, const boost::mpl::false_&) +void test_convert_neg_rat_val(From const&, const std::integral_constant&) { } template -void test_convert_imp(boost::mpl::int_ const&, boost::mpl::int_ const&) +void test_convert_imp(std::integral_constant const&, std::integral_constant const&) { int bits_wanted = (std::min)((std::min)(std::numeric_limits::digits, std::numeric_limits::digits), 2000); @@ -170,7 +170,7 @@ void test_convert_imp(boost::mpl::int_ const&, boost::mpl: To t2 = from.template convert_to(); BOOST_CHECK_EQUAL(from.str(), t1.str()); BOOST_CHECK_EQUAL(from.str(), t2.str()); - test_convert_neg_rat_val(from, boost::mpl::bool_ < std::numeric_limits::is_signed && std::numeric_limits::is_signed > ()); + test_convert_neg_rat_val(from, std::integral_constant::is_signed && std::numeric_limits::is_signed > ()); } } diff --git a/test/test_cpp_int.cpp b/test/test_cpp_int.cpp index 8ca4d8fd..a7f69534 100644 --- a/test/test_cpp_int.cpp +++ b/test/test_cpp_int.cpp @@ -73,10 +73,10 @@ T generate_random(unsigned bits_wanted) } template -struct is_checked_cpp_int : public boost::mpl::false_ +struct is_checked_cpp_int : public std::integral_constant {}; template -struct is_checked_cpp_int, ET> > : public boost::mpl::true_ +struct is_checked_cpp_int, ET> > : public std::integral_constant {}; template diff --git a/test/test_cpp_int_import_export.cpp b/test/test_cpp_int_import_export.cpp index 03a1a1c4..217cfca3 100644 --- a/test/test_cpp_int_import_export.cpp +++ b/test/test_cpp_int_import_export.cpp @@ -53,7 +53,7 @@ T generate_random() } template -void test_round_trip_neg(T val, const boost::mpl::true_&) +void test_round_trip_neg(T val, const std::integral_constant&) { // Try some negative values: std::vector cv; @@ -65,7 +65,7 @@ void test_round_trip_neg(T val, const boost::mpl::true_&) } template -void test_round_trip_neg(const T&, const boost::mpl::false_&) +void test_round_trip_neg(const T&, const std::integral_constant&) { } @@ -137,7 +137,7 @@ void test_round_trip(T val) import_bits(newval, cv.begin(), cv.end(), 6, false); BOOST_CHECK_EQUAL(val, newval); - test_round_trip_neg(val, boost::mpl::bool_::is_signed>()); + test_round_trip_neg(val, std::integral_constant::is_signed>()); } template diff --git a/test/test_cpp_int_karatsuba.cpp b/test/test_cpp_int_karatsuba.cpp index 44da6de8..914c6f3c 100644 --- a/test/test_cpp_int_karatsuba.cpp +++ b/test/test_cpp_int_karatsuba.cpp @@ -68,10 +68,10 @@ T generate_random(unsigned bits_wanted) } template -struct is_checked_cpp_int : public boost::mpl::false_ +struct is_checked_cpp_int : public std::integral_constant {}; template -struct is_checked_cpp_int, ET> > : public boost::mpl::true_ +struct is_checked_cpp_int, ET> > : public std::integral_constant {}; template diff --git a/test/test_cpp_int_left_shift.cpp b/test/test_cpp_int_left_shift.cpp index e0fe6c7f..af753e32 100644 --- a/test/test_cpp_int_left_shift.cpp +++ b/test/test_cpp_int_left_shift.cpp @@ -72,12 +72,12 @@ void test_value(const T& val) } } -void test(const boost::mpl::int_<200>&) {} +void test(const std::integral_constant&) {} template -void test(boost::mpl::int_ const&) +void test(std::integral_constant const&) { - test(boost::mpl::int_()); + test(std::integral_constant()); typedef boost::multiprecision::number, boost::multiprecision::et_off> mp_type; @@ -92,6 +92,6 @@ void test(boost::mpl::int_ const&) int main() { - test(boost::mpl::int_<24>()); + test(std::integral_constant()); return boost::report_errors(); } diff --git a/test/test_cpp_int_serial.cpp b/test/test_cpp_int_serial.cpp index 205eac3c..29dff32d 100644 --- a/test/test_cpp_int_serial.cpp +++ b/test/test_cpp_int_serial.cpp @@ -64,7 +64,7 @@ T generate_random(unsigned bits_wanted) } template -void test_neg(const T& x, const boost::mpl::true_&) +void test_neg(const T& x, const std::integral_constant&) { T val = -x; #ifndef BOOST_NO_EXCEPTIONS @@ -100,7 +100,7 @@ void test_neg(const T& x, const boost::mpl::true_&) #endif } template -void test_neg(const T&, const boost::mpl::false_&) {} +void test_neg(const T&, const std::integral_constant&) {} template void test() @@ -159,7 +159,7 @@ void test() std::cout << e.what() << std::endl; } #endif - test_neg(val, boost::mpl::bool_::is_signed>()); + test_neg(val, std::integral_constant::is_signed>()); // // Check to see if test is taking too long. // Tests run on the compiler farm time out after 300 seconds, diff --git a/test/test_cpp_rat_serial.cpp b/test/test_cpp_rat_serial.cpp index cde692eb..c093b82c 100644 --- a/test/test_cpp_rat_serial.cpp +++ b/test/test_cpp_rat_serial.cpp @@ -66,7 +66,7 @@ T generate_random(unsigned bits_wanted) } template -void test_neg(const T& x, const boost::mpl::true_&) +void test_neg(const T& x, const std::integral_constant&) { T val = -x; #ifndef BOOST_NO_EXCEPTIONS @@ -115,7 +115,7 @@ void test_neg(const T& x, const boost::mpl::true_&) #endif } template -void test_neg(const T&, const boost::mpl::false_&) {} +void test_neg(const T&, const std::integral_constant&) {} template void test() @@ -160,7 +160,7 @@ void test() std::cout << e.what() << std::endl; } #endif - test_neg(val, boost::mpl::bool_::is_signed>()); + test_neg(val, std::integral_constant::is_signed>()); // // Check to see if test is taking too long. diff --git a/test/test_eigen_interop.cpp b/test/test_eigen_interop.cpp index d4e3aba7..f18e22c0 100644 --- a/test/test_eigen_interop.cpp +++ b/test/test_eigen_interop.cpp @@ -52,18 +52,18 @@ struct NumTraits > { return (std::numeric_limits::min)(); } - static int digits10_imp(const boost::mpl::true_&) + static int digits10_imp(const std::integral_constant&) { return std::numeric_limits::digits10; } template - static int digits10_imp(const boost::mpl::bool_&) + static int digits10_imp(const std::integral_constant&) { return Real::default_precision(); } static int digits10() { - return digits10_imp(boost::mpl::bool_ < std::numeric_limits::digits10 && (std::numeric_limits::digits10 != INT_MAX) ? true : false > ()); + return digits10_imp(std::integral_constant::digits10 && (std::numeric_limits::digits10 != INT_MAX) ? true : false > ()); } }; diff --git a/test/test_int_io.cpp b/test/test_int_io.cpp index ece1c346..56c36c4d 100644 --- a/test/test_int_io.cpp +++ b/test/test_int_io.cpp @@ -104,17 +104,17 @@ void do_round_trip(const T& val) } template -void negative_round_trip(T val, const boost::mpl::true_&) +void negative_round_trip(T val, const std::integral_constant&) { do_round_trip(T(-val)); } template -void negative_round_trip(T, const boost::mpl::false_&) +void negative_round_trip(T, const std::integral_constant&) { } template -void negative_spots(const boost::mpl::true_&) +void negative_spots(const std::integral_constant&) { BOOST_CHECK_EQUAL(T(-1002).str(), "-1002"); if (!std::numeric_limits::is_modulo) @@ -126,7 +126,7 @@ void negative_spots(const boost::mpl::true_&) } } template -void negative_spots(const boost::mpl::false_&) +void negative_spots(const std::integral_constant&) { } @@ -137,7 +137,7 @@ void test_round_trip() { T val = generate_random(); do_round_trip(val); - negative_round_trip(val, boost::mpl::bool_::is_signed>()); + negative_round_trip(val, std::integral_constant::is_signed>()); } BOOST_CHECK_EQUAL(T(1002).str(), "1002"); @@ -151,7 +151,7 @@ void test_round_trip() BOOST_CHECK_EQUAL(T(1002).str(0, std::ios_base::dec), "1002"); BOOST_CHECK_EQUAL(T(1002).str(0, std::ios_base::dec | std::ios_base::showbase), "1002"); - negative_spots(boost::mpl::bool_::is_signed>()); + negative_spots(std::integral_constant::is_signed>()); } int main() diff --git a/test/test_mixed.hpp b/test/test_mixed.hpp index e2f3e53f..475159dc 100644 --- a/test/test_mixed.hpp +++ b/test/test_mixed.hpp @@ -9,7 +9,7 @@ #include "test.hpp" template -void test_floats(const boost::mpl::true_) +void test_floats(const std::integral_constant) { Big big_val = boost::math::constants::pi(); Small small = boost::math::constants::pi(); @@ -47,7 +47,7 @@ void test_floats(const boost::mpl::true_) } template -void test_floats(const boost::mpl::false_){} +void test_floats(const std::integral_constant){} template void test() @@ -227,7 +227,7 @@ void test() BOOST_CHECK_EQUAL((big_val * 1) * (small_val * 1), (big_val * 1) * Big((small_val * 1))); BOOST_CHECK_EQUAL((big_val * 1) / (small_val * 1), (big_val * 1) / Big((small_val * 1))); - test_floats(boost::mpl::bool_::value == boost::multiprecision::number_kind_floating_point>()); + test_floats(std::integral_constant::value == boost::multiprecision::number_kind_floating_point>()); } #endif // BOOST_MATH_TEST_MIXED_HPP diff --git a/test/test_numeric_limits.cpp b/test/test_numeric_limits.cpp index 545aff28..fe8885af 100644 --- a/test/test_numeric_limits.cpp +++ b/test/test_numeric_limits.cpp @@ -71,7 +71,7 @@ std::cout << BOOST_STRINGIZE(x) << " = " << std::numeric_limits::x << std::endl; template -void test_specific(const boost::mpl::int_&) +void test_specific(const std::integral_constant&) { Number minv, maxv; minv = (std::numeric_limits::min)(); @@ -152,7 +152,7 @@ void test_specific(const boost::mpl::int_ -void test_specific(const boost::mpl::int_&) +void test_specific(const std::integral_constant&) { if (std::numeric_limits::is_modulo) { @@ -175,7 +175,7 @@ void test() typedef typename std::conditional< std::numeric_limits::is_specialized, typename boost::multiprecision::number_category::type, - boost::mpl::int_<500> // not a number type + std::integral_constant // not a number type >::type fp_test_type; test_specific(fp_test_type()); diff --git a/test/test_rational_io.cpp b/test/test_rational_io.cpp index d25ec365..df957025 100644 --- a/test/test_rational_io.cpp +++ b/test/test_rational_io.cpp @@ -65,7 +65,7 @@ T generate_random() } template -void do_round_trip(const T& val, std::ios_base::fmtflags f, const boost::mpl::true_&) +void do_round_trip(const T& val, std::ios_base::fmtflags f, const std::integral_constant&) { std::stringstream ss; ss << std::setprecision(std::numeric_limits::max_digits10); @@ -78,7 +78,7 @@ void do_round_trip(const T& val, std::ios_base::fmtflags f, const boost::mpl::tr } template -void do_round_trip(const T& val, std::ios_base::fmtflags f, const boost::mpl::false_&) +void do_round_trip(const T& val, std::ios_base::fmtflags f, const std::integral_constant&) { std::stringstream ss; ss << std::setprecision(std::numeric_limits::digits10 + 4); @@ -90,10 +90,10 @@ void do_round_trip(const T& val, std::ios_base::fmtflags f, const boost::mpl::fa } template -struct is_number : public boost::mpl::false_ +struct is_number : public std::integral_constant {}; template -struct is_number > : public boost::mpl::true_ +struct is_number > : public std::integral_constant {}; template