From 9abf33884ba8cb2f53248a7eae170efa0df399d0 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Thu, 18 Jun 2015 09:08:52 +0100 Subject: [PATCH] Don't use conditional noexcept with gcc-4.6.x as it causes issues. See https://svn.boost.org/trac/boost/ticket/11402 --- .../boost/multiprecision/cpp_bin_float.hpp | 6 +- .../boost/multiprecision/cpp_dec_float.hpp | 6 +- include/boost/multiprecision/cpp_int.hpp | 58 +++++++++---------- include/boost/multiprecision/cpp_int/add.hpp | 44 +++++++------- .../boost/multiprecision/cpp_int/bitwise.hpp | 38 ++++++------ include/boost/multiprecision/cpp_int/misc.hpp | 14 ++--- .../boost/multiprecision/cpp_int/multiply.hpp | 28 ++++----- .../multiprecision/detail/number_base.hpp | 6 ++ include/boost/multiprecision/number.hpp | 34 +++++------ .../boost/multiprecision/rational_adaptor.hpp | 12 ++-- 10 files changed, 126 insertions(+), 120 deletions(-) diff --git a/include/boost/multiprecision/cpp_bin_float.hpp b/include/boost/multiprecision/cpp_bin_float.hpp index ec37bd38..4c007998 100644 --- a/include/boost/multiprecision/cpp_bin_float.hpp +++ b/include/boost/multiprecision/cpp_bin_float.hpp @@ -67,9 +67,9 @@ private: exponent_type m_exponent; bool m_sign; public: - cpp_bin_float() BOOST_NOEXCEPT_IF(noexcept(rep_type())) : m_data(), m_exponent(exponent_nan), m_sign(false) {} + cpp_bin_float() BOOST_MP_NOEXCEPT_IF(noexcept(rep_type())) : m_data(), m_exponent(exponent_nan), m_sign(false) {} - cpp_bin_float(const cpp_bin_float &o) BOOST_NOEXCEPT_IF(noexcept(rep_type(std::declval()))) + cpp_bin_float(const cpp_bin_float &o) BOOST_MP_NOEXCEPT_IF(noexcept(rep_type(std::declval()))) : m_data(o.m_data), m_exponent(o.m_exponent), m_sign(o.m_sign) {} template @@ -104,7 +104,7 @@ public: this->assign_float(f); } - cpp_bin_float& operator=(const cpp_bin_float &o) BOOST_NOEXCEPT_IF(noexcept(std::declval() = std::declval())) + cpp_bin_float& operator=(const cpp_bin_float &o) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval() = std::declval())) { m_data = o.m_data; m_exponent = o.m_exponent; diff --git a/include/boost/multiprecision/cpp_dec_float.hpp b/include/boost/multiprecision/cpp_dec_float.hpp index 0dd0a40e..737f9250 100644 --- a/include/boost/multiprecision/cpp_dec_float.hpp +++ b/include/boost/multiprecision/cpp_dec_float.hpp @@ -170,7 +170,7 @@ private: public: // Constructors - cpp_dec_float() BOOST_NOEXCEPT_IF(noexcept(array_type())) : + cpp_dec_float() BOOST_MP_NOEXCEPT_IF(noexcept(array_type())) : data(), exp (static_cast(0)), neg (false), @@ -215,7 +215,7 @@ public: from_unsigned_long_long(i); } - cpp_dec_float(const cpp_dec_float& f) BOOST_NOEXCEPT_IF(noexcept(array_type(std::declval()))) : + cpp_dec_float(const cpp_dec_float& f) BOOST_MP_NOEXCEPT_IF(noexcept(array_type(std::declval()))) : data (f.data), exp (f.exp), neg (f.neg), @@ -379,7 +379,7 @@ public: } // Basic operations. - cpp_dec_float& operator=(const cpp_dec_float& v) BOOST_NOEXCEPT_IF(noexcept(std::declval() = std::declval())) + cpp_dec_float& operator=(const cpp_dec_float& v) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval() = std::declval())) { data = v.data; exp = v.exp; diff --git a/include/boost/multiprecision/cpp_int.hpp b/include/boost/multiprecision/cpp_int.hpp index 0a4cc46c..d451567b 100644 --- a/include/boost/multiprecision/cpp_int.hpp +++ b/include/boost/multiprecision/cpp_int.hpp @@ -466,12 +466,12 @@ public: m_sign = false; } } - BOOST_MP_FORCEINLINE void resize(unsigned new_size, unsigned min_size) BOOST_NOEXCEPT_IF((Checked == unchecked)) + BOOST_MP_FORCEINLINE void resize(unsigned new_size, unsigned min_size) BOOST_MP_NOEXCEPT_IF((Checked == unchecked)) { m_limbs = static_cast((std::min)(new_size, internal_limb_count)); detail::verify_new_size(m_limbs, min_size, checked_type()); } - BOOST_MP_FORCEINLINE void normalize() BOOST_NOEXCEPT_IF((Checked == unchecked)) + BOOST_MP_FORCEINLINE void normalize() BOOST_MP_NOEXCEPT_IF((Checked == unchecked)) { limb_pointer p = limbs(); detail::verify_limb_mask(m_limbs == internal_limb_count, p[internal_limb_count-1], upper_limb_mask, checked_type()); @@ -581,12 +581,12 @@ public: // BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(limb_type i)BOOST_NOEXCEPT : m_wrapper(i), m_limbs(1) {} - BOOST_MP_FORCEINLINE cpp_int_base(signed_limb_type i)BOOST_NOEXCEPT_IF((Checked == unchecked)) + BOOST_MP_FORCEINLINE cpp_int_base(signed_limb_type i)BOOST_MP_NOEXCEPT_IF((Checked == unchecked)) : m_wrapper(limb_type(i < 0 ? static_cast(-static_cast(i)) : i)), m_limbs(1) { if(i < 0) negate(); } #ifdef BOOST_LITTLE_ENDIAN BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(double_limb_type i)BOOST_NOEXCEPT : m_wrapper(i), m_limbs(i > max_limb_value ? 2 : 1) {} - BOOST_MP_FORCEINLINE cpp_int_base(signed_double_limb_type i)BOOST_NOEXCEPT_IF((Checked == unchecked)) + BOOST_MP_FORCEINLINE cpp_int_base(signed_double_limb_type i)BOOST_MP_NOEXCEPT_IF((Checked == unchecked)) : m_wrapper(double_limb_type(i < 0 ? static_cast(boost::multiprecision::detail::unsigned_abs(i)) : i)), m_limbs(i < 0 ? (static_cast(boost::multiprecision::detail::unsigned_abs(i)) > max_limb_value ? 2 : 1) : (i > max_limb_value ? 2 : 1)) { @@ -607,13 +607,13 @@ public: BOOST_MP_FORCEINLINE limb_pointer limbs() BOOST_NOEXCEPT { return m_wrapper.m_data; } BOOST_MP_FORCEINLINE BOOST_CONSTEXPR const_limb_pointer limbs()const BOOST_NOEXCEPT { return m_wrapper.m_data; } BOOST_MP_FORCEINLINE BOOST_CONSTEXPR bool sign()const BOOST_NOEXCEPT { return false; } - BOOST_MP_FORCEINLINE void sign(bool b) BOOST_NOEXCEPT_IF((Checked == unchecked)) { if(b) negate(); } - BOOST_MP_FORCEINLINE void resize(unsigned new_size, unsigned min_size) BOOST_NOEXCEPT_IF((Checked == unchecked)) + BOOST_MP_FORCEINLINE void sign(bool b) BOOST_MP_NOEXCEPT_IF((Checked == unchecked)) { if(b) negate(); } + BOOST_MP_FORCEINLINE void resize(unsigned new_size, unsigned min_size) BOOST_MP_NOEXCEPT_IF((Checked == unchecked)) { m_limbs = (std::min)(new_size, internal_limb_count); detail::verify_new_size(m_limbs, min_size, checked_type()); } - BOOST_MP_FORCEINLINE void normalize() BOOST_NOEXCEPT_IF((Checked == unchecked)) + BOOST_MP_FORCEINLINE void normalize() BOOST_MP_NOEXCEPT_IF((Checked == unchecked)) { limb_pointer p = limbs(); detail::verify_limb_mask(m_limbs == internal_limb_count, p[internal_limb_count-1], upper_limb_mask, checked_type()); @@ -643,7 +643,7 @@ private: } void check_negate(const mpl::int_&){} public: - void negate() BOOST_NOEXCEPT_IF((Checked == unchecked)) + void negate() BOOST_MP_NOEXCEPT_IF((Checked == unchecked)) { // Not so much a negate as a complement - this gets called when subtraction // would result in a "negative" number: @@ -750,7 +750,7 @@ protected: void check_in_range(T, const mpl::int_&) BOOST_NOEXCEPT {} template - void check_in_range(T val) BOOST_NOEXCEPT_IF(noexcept(std::declval().check_in_range(std::declval(), checked_type()))) + void check_in_range(T val) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval().check_in_range(std::declval(), checked_type()))) { check_in_range(val, checked_type()); } @@ -760,17 +760,17 @@ public: // Direct construction: // template - BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(SI i, typename boost::enable_if_c::value && (Checked == unchecked) >::type const* = 0) BOOST_NOEXCEPT_IF(noexcept(std::declval().check_in_range(std::declval()))) + BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(SI i, typename boost::enable_if_c::value && (Checked == unchecked) >::type const* = 0) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval().check_in_range(std::declval()))) : m_data(i < 0 ? static_cast(static_cast::type>(boost::multiprecision::detail::unsigned_abs(i)) & limb_mask) : static_cast(i)& limb_mask), m_sign(i < 0) {} template - BOOST_MP_FORCEINLINE cpp_int_base(SI i, typename boost::enable_if_c::value && (Checked == checked) >::type const* = 0) BOOST_NOEXCEPT_IF(noexcept(std::declval().check_in_range(std::declval()))) + BOOST_MP_FORCEINLINE cpp_int_base(SI i, typename boost::enable_if_c::value && (Checked == checked) >::type const* = 0) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval().check_in_range(std::declval()))) : m_data(i < 0 ? (static_cast(static_cast::type>(boost::multiprecision::detail::unsigned_abs(i)) & limb_mask)) : static_cast(i)& limb_mask), m_sign(i < 0) { check_in_range(i); } template BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(UI i, typename boost::enable_if_c::value && (Checked == unchecked)>::type const* = 0) BOOST_NOEXCEPT : m_data(static_cast(i) & limb_mask), m_sign(false) {} template - BOOST_MP_FORCEINLINE cpp_int_base(UI i, typename boost::enable_if_c::value && (Checked == checked)>::type const* = 0) BOOST_NOEXCEPT_IF(noexcept(std::declval().check_in_range(std::declval()))) + BOOST_MP_FORCEINLINE cpp_int_base(UI i, typename boost::enable_if_c::value && (Checked == checked)>::type const* = 0) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval().check_in_range(std::declval()))) : m_data(static_cast(i) & limb_mask), m_sign(false) { check_in_range(i); } template BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(F i, typename boost::enable_if_c::value && (Checked == unchecked)>::type const* = 0) BOOST_NOEXCEPT @@ -810,7 +810,7 @@ public: { detail::verify_new_size(2, min_size, checked_type()); } - BOOST_MP_FORCEINLINE void normalize() BOOST_NOEXCEPT_IF((Checked == unchecked)) + BOOST_MP_FORCEINLINE void normalize() BOOST_MP_NOEXCEPT_IF((Checked == unchecked)) { if(!m_data) m_sign = false; // zero is always unsigned @@ -893,7 +893,7 @@ protected: BOOST_MP_FORCEINLINE void check_in_range(T, const mpl::int_&, const boost::integral_constant&) BOOST_NOEXCEPT {} template - BOOST_MP_FORCEINLINE void check_in_range(T val) BOOST_NOEXCEPT_IF(noexcept(std::declval().check_in_range(std::declval(), checked_type(), is_signed()))) + BOOST_MP_FORCEINLINE void check_in_range(T val) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval().check_in_range(std::declval(), checked_type(), is_signed()))) { check_in_range(val, checked_type(), is_signed()); } @@ -906,16 +906,16 @@ public: BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(SI i, typename boost::enable_if_c::value && (Checked == unchecked) >::type const* = 0) BOOST_NOEXCEPT : m_data(i < 0 ? (1 + ~static_cast(-i)) & limb_mask : static_cast(i) & limb_mask) {} template - BOOST_MP_FORCEINLINE cpp_int_base(SI i, typename boost::enable_if_c::value && (Checked == checked) >::type const* = 0) BOOST_NOEXCEPT_IF(noexcept(std::declval().check_in_range(std::declval()))) + BOOST_MP_FORCEINLINE cpp_int_base(SI i, typename boost::enable_if_c::value && (Checked == checked) >::type const* = 0) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval().check_in_range(std::declval()))) : m_data(i < 0 ? 1 + ~static_cast(-i) : static_cast(i)) { check_in_range(i); } template BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(UI i, typename boost::enable_if_c::value && (Checked == unchecked) >::type const* = 0) BOOST_NOEXCEPT : m_data(static_cast(i) & limb_mask) {} template - BOOST_MP_FORCEINLINE cpp_int_base(UI i, typename boost::enable_if_c::value && (Checked == checked) >::type const* = 0) BOOST_NOEXCEPT_IF(noexcept(std::declval().check_in_range(std::declval()))) + BOOST_MP_FORCEINLINE cpp_int_base(UI i, typename boost::enable_if_c::value && (Checked == checked) >::type const* = 0) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval().check_in_range(std::declval()))) : m_data(static_cast(i)) { check_in_range(i); } template - BOOST_MP_FORCEINLINE cpp_int_base(F i, typename boost::enable_if >::type const* = 0) BOOST_NOEXCEPT_IF((Checked == unchecked)) + BOOST_MP_FORCEINLINE cpp_int_base(F i, typename boost::enable_if >::type const* = 0) BOOST_MP_NOEXCEPT_IF((Checked == unchecked)) : m_data(static_cast(std::fabs(i)) & limb_mask) { check_in_range(i); @@ -939,7 +939,7 @@ public: BOOST_MP_FORCEINLINE limb_pointer limbs() BOOST_NOEXCEPT { return &m_data; } BOOST_MP_FORCEINLINE BOOST_CONSTEXPR const_limb_pointer limbs()const BOOST_NOEXCEPT { return &m_data; } BOOST_MP_FORCEINLINE BOOST_CONSTEXPR bool sign()const BOOST_NOEXCEPT { return false; } - BOOST_MP_FORCEINLINE void sign(bool b) BOOST_NOEXCEPT_IF((Checked == unchecked)) + BOOST_MP_FORCEINLINE void sign(bool b) BOOST_MP_NOEXCEPT_IF((Checked == unchecked)) { if(b) negate(); @@ -948,7 +948,7 @@ public: { detail::verify_new_size(2, min_size, checked_type()); } - BOOST_MP_FORCEINLINE void normalize() BOOST_NOEXCEPT_IF((Checked == unchecked)) + BOOST_MP_FORCEINLINE void normalize() BOOST_MP_NOEXCEPT_IF((Checked == unchecked)) { detail::verify_limb_mask(true, m_data, limb_mask, checked_type()); m_data &= limb_mask; @@ -962,7 +962,7 @@ public: { m_data = o.m_data; } - BOOST_MP_FORCEINLINE void negate() BOOST_NOEXCEPT_IF((Checked == unchecked)) + BOOST_MP_FORCEINLINE void negate() BOOST_MP_NOEXCEPT_IF((Checked == unchecked)) { if(Checked == checked) { @@ -1042,7 +1042,7 @@ public: typedef mpl::int_ checked_type; BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_backend() BOOST_NOEXCEPT{} - BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_backend(const cpp_int_backend& o) BOOST_NOEXCEPT_IF(boost::is_void::value) : base_type(o) {} + BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_backend(const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF(boost::is_void::value) : base_type(o) {} #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_backend(cpp_int_backend&& o) BOOST_NOEXCEPT : base_type(static_cast(o)) {} @@ -1051,7 +1051,7 @@ public: // Direct construction from arithmetic type: // template - BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_backend(Arg i, typename boost::enable_if_c::value >::type const* = 0)BOOST_NOEXCEPT_IF(noexcept(base_type(std::declval()))) + BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_backend(Arg i, typename boost::enable_if_c::value >::type const* = 0)BOOST_MP_NOEXCEPT_IF(noexcept(base_type(std::declval()))) : base_type(i) {} private: @@ -1140,13 +1140,13 @@ public: : base_type(static_cast(a), tag){} #endif - BOOST_MP_FORCEINLINE cpp_int_backend& operator = (const cpp_int_backend& o) BOOST_NOEXCEPT_IF(noexcept(std::declval().assign(std::declval()))) + BOOST_MP_FORCEINLINE cpp_int_backend& operator = (const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval().assign(std::declval()))) { this->assign(o); return *this; } #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - BOOST_MP_FORCEINLINE cpp_int_backend& operator = (cpp_int_backend&& o) BOOST_NOEXCEPT_IF(noexcept(std::declval() = std::declval())) + BOOST_MP_FORCEINLINE cpp_int_backend& operator = (cpp_int_backend&& o) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval() = std::declval())) { *static_cast(this) = static_cast(o); return *this; @@ -1155,7 +1155,7 @@ public: private: template typename boost::enable_if >::type do_assign_arithmetic(A val, const mpl::true_&) - BOOST_NOEXCEPT_IF(noexcept(std::declval().check_in_range(std::declval()))) + BOOST_MP_NOEXCEPT_IF(noexcept(std::declval().check_in_range(std::declval()))) { this->check_in_range(val); *this->limbs() = static_cast(val); @@ -1163,7 +1163,7 @@ private: } template typename boost::disable_if_c::value || !is_integral::value >::type do_assign_arithmetic(A val, const mpl::true_&) - BOOST_NOEXCEPT_IF(noexcept(std::declval().check_in_range(std::declval())) && noexcept(std::declval().sign(true))) + BOOST_MP_NOEXCEPT_IF(noexcept(std::declval().check_in_range(std::declval())) && noexcept(std::declval().sign(true))) { this->check_in_range(val); *this->limbs() = (val < 0) ? static_cast(boost::multiprecision::detail::unsigned_abs(val)) : static_cast(val); @@ -1184,7 +1184,7 @@ private: *this->limbs() = i; this->sign(false); } - BOOST_MP_FORCEINLINE void do_assign_arithmetic(signed_limb_type i, const mpl::false_&) BOOST_NOEXCEPT_IF(noexcept(std::declval().sign(true))) + BOOST_MP_FORCEINLINE void do_assign_arithmetic(signed_limb_type i, const mpl::false_&) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval().sign(true))) { this->resize(1, 1); *this->limbs() = static_cast(boost::multiprecision::detail::unsigned_abs(i)); @@ -1200,7 +1200,7 @@ private: this->resize(p[1] ? 2 : 1, p[1] ? 2 : 1); this->sign(false); } - void do_assign_arithmetic(signed_double_limb_type i, const mpl::false_&) BOOST_NOEXCEPT_IF(noexcept(std::declval().sign(true))) + void do_assign_arithmetic(signed_double_limb_type i, const mpl::false_&) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval().sign(true))) { BOOST_STATIC_ASSERT(sizeof(i) == 2 * sizeof(limb_type)); BOOST_STATIC_ASSERT(base_type::internal_limb_count >= 2); @@ -1270,7 +1270,7 @@ private: } public: template - BOOST_MP_FORCEINLINE cpp_int_backend& operator = (Arithmetic val) BOOST_NOEXCEPT_IF(noexcept(std::declval().do_assign_arithmetic(std::declval(), trivial_tag()))) + BOOST_MP_FORCEINLINE cpp_int_backend& operator = (Arithmetic val) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval().do_assign_arithmetic(std::declval(), trivial_tag()))) { do_assign_arithmetic(val, trivial_tag()); return *this; diff --git a/include/boost/multiprecision/cpp_int/add.hpp b/include/boost/multiprecision/cpp_int/add.hpp index f9c9b85e..372998d6 100644 --- a/include/boost/multiprecision/cpp_int/add.hpp +++ b/include/boost/multiprecision/cpp_int/add.hpp @@ -14,7 +14,7 @@ namespace boost{ namespace multiprecision{ namespace backends{ // This is the key addition routine where all the argument types are non-trivial cpp_int's: // template -inline void add_unsigned(CppInt1& result, const CppInt2& a, const CppInt3& b) BOOST_NOEXCEPT_IF(is_non_throwing_cpp_int::value) +inline void add_unsigned(CppInt1& result, const CppInt2& a, const CppInt3& b) BOOST_MP_NOEXCEPT_IF(is_non_throwing_cpp_int::value) { using std::swap; @@ -81,7 +81,7 @@ inline void add_unsigned(CppInt1& result, const CppInt2& a, const CppInt3& b) BO // As above, but for adding a single limb to a non-trivial cpp_int: // template -inline void add_unsigned(CppInt1& result, const CppInt2& a, const limb_type& o) BOOST_NOEXCEPT_IF(is_non_throwing_cpp_int::value) +inline void add_unsigned(CppInt1& result, const CppInt2& a, const limb_type& o) BOOST_MP_NOEXCEPT_IF(is_non_throwing_cpp_int::value) { // Addition using modular arithmetic. // Nothing fancy, just let uintmax_t take the strain: @@ -119,7 +119,7 @@ inline void add_unsigned(CppInt1& result, const CppInt2& a, const limb_type& o) // Core subtraction routine for all non-trivial cpp_int's: // template -inline void subtract_unsigned(CppInt1& result, const CppInt2& a, const CppInt3& b) BOOST_NOEXCEPT_IF(is_non_throwing_cpp_int::value) +inline void subtract_unsigned(CppInt1& result, const CppInt2& a, const CppInt3& b) BOOST_MP_NOEXCEPT_IF(is_non_throwing_cpp_int::value) { using std::swap; @@ -203,7 +203,7 @@ inline void subtract_unsigned(CppInt1& result, const CppInt2& a, const CppInt3& // And again to subtract a single limb: // template -inline void subtract_unsigned(CppInt1& result, const CppInt2& a, const limb_type& b) BOOST_NOEXCEPT_IF(is_non_throwing_cpp_int::value) +inline void subtract_unsigned(CppInt1& result, const CppInt2& a, const limb_type& b) BOOST_MP_NOEXCEPT_IF(is_non_throwing_cpp_int::value) { // Subtract one limb. // Nothing fancy, just let uintmax_t take the strain: @@ -264,7 +264,7 @@ template >::value && !is_trivial_cpp_int >::value >::type eval_add( cpp_int_backend& result, - const cpp_int_backend& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { eval_add(result, result, o); } @@ -273,7 +273,7 @@ inline typename enable_if_c& result, const cpp_int_backend& a, - const cpp_int_backend& b) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& b) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { if(a.sign() != b.sign()) { @@ -284,7 +284,7 @@ inline typename enable_if_c BOOST_MP_FORCEINLINE typename enable_if_c >::value>::type - eval_add(cpp_int_backend& result, const limb_type& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + eval_add(cpp_int_backend& result, const limb_type& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { if(result.sign()) { @@ -298,7 +298,7 @@ BOOST_MP_FORCEINLINE typename enable_if_c& result, const cpp_int_backend& a, - const limb_type& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const limb_type& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { if(a.sign()) { @@ -311,7 +311,7 @@ template >::value>::type eval_add( cpp_int_backend& result, - const signed_limb_type& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const signed_limb_type& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { if(o < 0) eval_subtract(result, static_cast(boost::multiprecision::detail::unsigned_abs(o))); @@ -323,7 +323,7 @@ BOOST_MP_FORCEINLINE typename enable_if_c& result, const cpp_int_backend& a, - const signed_limb_type& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const signed_limb_type& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { if(o < 0) eval_subtract(result, a, static_cast(boost::multiprecision::detail::unsigned_abs(o))); @@ -336,7 +336,7 @@ template >::value>::type eval_subtract( cpp_int_backend& result, - const limb_type& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const limb_type& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { if(result.sign()) { @@ -350,7 +350,7 @@ BOOST_MP_FORCEINLINE typename enable_if_c& result, const cpp_int_backend& a, - const limb_type& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const limb_type& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { if(a.sign()) { @@ -365,7 +365,7 @@ template >::value>::type eval_subtract( cpp_int_backend& result, - const signed_limb_type& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const signed_limb_type& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { if(o) { @@ -380,7 +380,7 @@ BOOST_MP_FORCEINLINE typename enable_if_c& result, const cpp_int_backend& a, - const signed_limb_type& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const signed_limb_type& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { if(o) { @@ -395,7 +395,7 @@ BOOST_MP_FORCEINLINE typename enable_if_c BOOST_MP_FORCEINLINE typename enable_if_c >::value>::type - eval_increment(cpp_int_backend& result) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + eval_increment(cpp_int_backend& result) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { static const limb_type one = 1; if(!result.sign() && (result.limbs()[0] < cpp_int_backend::max_limb_value)) @@ -407,7 +407,7 @@ BOOST_MP_FORCEINLINE typename enable_if_c BOOST_MP_FORCEINLINE typename enable_if_c >::value>::type - eval_decrement(cpp_int_backend& result) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + eval_decrement(cpp_int_backend& result) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { static const limb_type one = 1; if(!result.sign() && result.limbs()[0]) @@ -421,7 +421,7 @@ template >::value && !is_trivial_cpp_int >::value >::type eval_subtract( cpp_int_backend& result, - const cpp_int_backend& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { eval_subtract(result, result, o); } @@ -430,7 +430,7 @@ BOOST_MP_FORCEINLINE typename enable_if_c& result, const cpp_int_backend& a, - const cpp_int_backend& b) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& b) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { if(a.sign() != b.sign()) { @@ -453,7 +453,7 @@ inline typename enable_if_c< >::type eval_add( cpp_int_backend& result, - const cpp_int_backend& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { if(result.sign() != o.sign()) { @@ -478,7 +478,7 @@ BOOST_MP_FORCEINLINE typename enable_if_c< && is_unsigned_number >::value >::type eval_add(cpp_int_backend& result, - const cpp_int_backend& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { *result.limbs() = detail::checked_add(*result.limbs(), *o.limbs(), typename cpp_int_backend::checked_type()); result.normalize(); @@ -493,7 +493,7 @@ inline typename enable_if_c< >::type eval_subtract( cpp_int_backend& result, - const cpp_int_backend& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { if(result.sign() != o.sign()) { @@ -518,7 +518,7 @@ BOOST_MP_FORCEINLINE typename enable_if_c< >::type eval_subtract( cpp_int_backend& result, - const cpp_int_backend& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { *result.limbs() = detail::checked_subtract(*result.limbs(), *o.limbs(), typename cpp_int_backend::checked_type()); result.normalize(); diff --git a/include/boost/multiprecision/cpp_int/bitwise.hpp b/include/boost/multiprecision/cpp_int/bitwise.hpp index 63d3b639..a39e2590 100644 --- a/include/boost/multiprecision/cpp_int/bitwise.hpp +++ b/include/boost/multiprecision/cpp_int/bitwise.hpp @@ -44,7 +44,7 @@ template void bitwise_op( CppInt1& result, const CppInt2& o, - Op op, const mpl::true_&) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int::value)) + Op op, const mpl::true_&) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int::value)) { // // There are 4 cases: @@ -184,7 +184,7 @@ template void bitwise_op( CppInt1& result, const CppInt2& o, - Op op, const mpl::false_&) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int::value)) + Op op, const mpl::false_&) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int::value)) { // // Both arguments are unsigned types, very simple case handled as a special case. @@ -217,7 +217,7 @@ template >::value && !is_trivial_cpp_int >::value >::type eval_bitwise_and( cpp_int_backend& result, - const cpp_int_backend& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { bitwise_op(result, o, bit_and(), mpl::bool_ > >::is_signed || std::numeric_limits > >::is_signed>()); @@ -227,7 +227,7 @@ template >::value && !is_trivial_cpp_int >::value >::type eval_bitwise_or( cpp_int_backend& result, - const cpp_int_backend& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { bitwise_op(result, o, bit_or(), mpl::bool_ > >::is_signed || std::numeric_limits > >::is_signed>()); @@ -237,7 +237,7 @@ template >::value && !is_trivial_cpp_int >::value >::type eval_bitwise_xor( cpp_int_backend& result, - const cpp_int_backend& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { bitwise_op(result, o, bit_xor(), mpl::bool_ > >::is_signed || std::numeric_limits > >::is_signed>()); @@ -277,7 +277,7 @@ template >::value && !is_trivial_cpp_int >::value && !is_trivial_cpp_int >::value >::type eval_complement( cpp_int_backend& result, - const cpp_int_backend& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { BOOST_STATIC_ASSERT_MSG(((Checked1 != checked) || (Checked2 != checked)), "Attempt to take the complement of a signed type results in undefined behavior."); // Increment and negate: @@ -290,7 +290,7 @@ template >::value && !is_trivial_cpp_int >::value && !is_trivial_cpp_int >::value >::type eval_complement( cpp_int_backend& result, - const cpp_int_backend& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { unsigned os = o.size(); result.resize(UINT_MAX, os); @@ -305,7 +305,7 @@ template >::value>::type eval_left_shift( cpp_int_backend& result, - double_limb_type s) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + double_limb_type s) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { is_valid_bitwise_op(result, typename cpp_int_backend::checked_type()); if(!s) @@ -382,7 +382,7 @@ template >::value>::type eval_right_shift( cpp_int_backend& result, - double_limb_type s) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + double_limb_type s) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { is_valid_bitwise_op(result, typename cpp_int_backend::checked_type()); if(!s) @@ -442,7 +442,7 @@ inline typename enable_if_c BOOST_MP_FORCEINLINE typename enable_if > >::type - eval_left_shift(cpp_int_backend& result, T s) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + eval_left_shift(cpp_int_backend& result, T s) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { is_valid_bitwise_op(result, typename cpp_int_backend::checked_type()); *result.limbs() = detail::checked_left_shift(*result.limbs(), s, typename cpp_int_backend::checked_type()); @@ -451,7 +451,7 @@ BOOST_MP_FORCEINLINE typename enable_if BOOST_MP_FORCEINLINE typename enable_if > >::type - eval_right_shift(cpp_int_backend& result, T s) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + eval_right_shift(cpp_int_backend& result, T s) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { // Nothing to check here... just make sure we don't invoke undefined behavior: is_valid_bitwise_op(result, typename cpp_int_backend::checked_type()); @@ -466,7 +466,7 @@ inline typename enable_if_c< >::type eval_bitwise_and( cpp_int_backend& result, - const cpp_int_backend& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { is_valid_bitwise_op(result, o, typename cpp_int_backend::checked_type()); @@ -503,7 +503,7 @@ inline typename enable_if_c< >::type eval_bitwise_and( cpp_int_backend& result, - const cpp_int_backend& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { *result.limbs() &= *o.limbs(); } @@ -516,7 +516,7 @@ inline typename enable_if_c< >::type eval_bitwise_or( cpp_int_backend& result, - const cpp_int_backend& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { is_valid_bitwise_op(result, o, typename cpp_int_backend::checked_type()); @@ -554,7 +554,7 @@ inline typename enable_if_c< >::type eval_bitwise_or( cpp_int_backend& result, - const cpp_int_backend& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { *result.limbs() |= *o.limbs(); } @@ -567,7 +567,7 @@ inline typename enable_if_c< >::type eval_bitwise_xor( cpp_int_backend& result, - const cpp_int_backend& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { is_valid_bitwise_op(result, o, typename cpp_int_backend::checked_type()); @@ -604,7 +604,7 @@ inline typename enable_if_c< >::type eval_bitwise_xor( cpp_int_backend& result, - const cpp_int_backend& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { *result.limbs() ^= *o.limbs(); } @@ -617,7 +617,7 @@ inline typename enable_if_c< >::type eval_complement( cpp_int_backend& result, - const cpp_int_backend& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { BOOST_STATIC_ASSERT_MSG(((Checked1 != checked) || (Checked2 != checked)), "Attempt to take the complement of a signed type results in undefined behavior."); // @@ -645,7 +645,7 @@ inline typename enable_if_c< >::type eval_complement( cpp_int_backend& result, - const cpp_int_backend& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { *result.limbs() = ~*o.limbs(); result.normalize(); diff --git a/include/boost/multiprecision/cpp_int/misc.hpp b/include/boost/multiprecision/cpp_int/misc.hpp index 266edac2..a124710c 100644 --- a/include/boost/multiprecision/cpp_int/misc.hpp +++ b/include/boost/multiprecision/cpp_int/misc.hpp @@ -55,7 +55,7 @@ inline Integer negate_integer(Integer i, const mpl::false_&) BOOST_NOEXCEPT template inline typename enable_if_c::value && !is_trivial_cpp_int >::value, void>::type - eval_convert_to(R* result, const cpp_int_backend& backend) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + eval_convert_to(R* result, const cpp_int_backend& backend) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { typedef mpl::int_ checked_type; check_in_range(backend, checked_type()); @@ -76,7 +76,7 @@ inline typename enable_if_c::value && !is_trivial_cpp_int inline typename enable_if_c::value && !is_trivial_cpp_int >::value, void>::type - eval_convert_to(R* result, const cpp_int_backend& backend) BOOST_NOEXCEPT_IF(is_arithmetic::value) + eval_convert_to(R* result, const cpp_int_backend& backend) BOOST_MP_NOEXCEPT_IF(is_arithmetic::value) { typename cpp_int_backend::const_limb_pointer p = backend.limbs(); unsigned shift = cpp_int_backend::limb_bits; @@ -104,7 +104,7 @@ BOOST_MP_FORCEINLINE typename enable_if_c BOOST_MP_FORCEINLINE typename enable_if_c >::value>::type - eval_abs(cpp_int_backend& result, const cpp_int_backend& val) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + eval_abs(cpp_int_backend& result, const cpp_int_backend& val) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { result = val; result.sign(false); @@ -234,7 +234,7 @@ inline typename enable_if_c& x, const cpp_int_backend& y, cpp_int_backend& q, - cpp_int_backend& r) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + cpp_int_backend& r) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { divide_unsigned_helper(&q, x, y, r); q.sign(x.sign() != y.sign()); @@ -247,7 +247,7 @@ inline typename enable_if_c& x, limb_type y, cpp_int_backend& q, - cpp_int_backend& r) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + cpp_int_backend& r) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { divide_unsigned_helper(&q, x, y, r); q.sign(x.sign()); @@ -259,7 +259,7 @@ inline typename enable_if_c::value>::type eval_qr( const cpp_int_backend& x, U y, cpp_int_backend& q, - cpp_int_backend& r) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + cpp_int_backend& r) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { using default_ops::eval_qr; cpp_int_backend t(y); @@ -511,7 +511,7 @@ BOOST_MP_FORCEINLINE typename enable_if_c BOOST_MP_FORCEINLINE typename enable_if_c >::value && (Checked1 == unchecked)>::type - eval_lcm(cpp_int_backend& result, const cpp_int_backend& a, const cpp_int_backend& b) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + eval_lcm(cpp_int_backend& result, const cpp_int_backend& a, const cpp_int_backend& b) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { *result.limbs() = boost::integer::lcm(*a.limbs(), *b.limbs()); result.normalize(); // result may overflow the specified number of bits diff --git a/include/boost/multiprecision/cpp_int/multiply.hpp b/include/boost/multiprecision/cpp_int/multiply.hpp index dbd8e29a..226bc9d1 100644 --- a/include/boost/multiprecision/cpp_int/multiply.hpp +++ b/include/boost/multiprecision/cpp_int/multiply.hpp @@ -15,7 +15,7 @@ inline typename enable_if_c& result, const cpp_int_backend& a, - const limb_type& val) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const limb_type& val) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { if(!val) { @@ -67,7 +67,7 @@ inline typename enable_if_c& result, const cpp_int_backend& a, - const cpp_int_backend& b) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& b) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { // Very simple long multiplication, only usable for small numbers of limb_type's // but that's the typical use case for this type anyway: @@ -159,14 +159,14 @@ template >::value && !is_trivial_cpp_int >::value >::type eval_multiply( cpp_int_backend& result, - const cpp_int_backend& a) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& a) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { eval_multiply(result, result, a); } template BOOST_MP_FORCEINLINE typename enable_if_c >::value>::type - eval_multiply(cpp_int_backend& result, const limb_type& val) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + eval_multiply(cpp_int_backend& result, const limb_type& val) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { eval_multiply(result, result, val); } @@ -176,7 +176,7 @@ BOOST_MP_FORCEINLINE typename enable_if_c& result, const cpp_int_backend& a, - const double_limb_type& val) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const double_limb_type& val) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { if(val <= (std::numeric_limits::max)()) { @@ -191,7 +191,7 @@ BOOST_MP_FORCEINLINE typename enable_if_c BOOST_MP_FORCEINLINE typename enable_if_c >::value>::type - eval_multiply(cpp_int_backend& result, const double_limb_type& val) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + eval_multiply(cpp_int_backend& result, const double_limb_type& val) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { eval_multiply(result, result, val); } @@ -201,7 +201,7 @@ BOOST_MP_FORCEINLINE typename enable_if_c& result, const cpp_int_backend& a, - const signed_limb_type& val) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const signed_limb_type& val) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { if(val > 0) eval_multiply(result, a, static_cast(val)); @@ -214,7 +214,7 @@ BOOST_MP_FORCEINLINE typename enable_if_c BOOST_MP_FORCEINLINE typename enable_if_c >::value>::type - eval_multiply(cpp_int_backend& result, const signed_limb_type& val) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + eval_multiply(cpp_int_backend& result, const signed_limb_type& val) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { eval_multiply(result, result, val); } @@ -224,7 +224,7 @@ inline typename enable_if_c& result, const cpp_int_backend& a, - const signed_double_limb_type& val) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const signed_double_limb_type& val) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { if(val > 0) { @@ -246,7 +246,7 @@ inline typename enable_if_c BOOST_MP_FORCEINLINE typename enable_if_c >::value>::type - eval_multiply(cpp_int_backend& result, const signed_double_limb_type& val) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + eval_multiply(cpp_int_backend& result, const signed_double_limb_type& val) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { eval_multiply(result, result, val); } @@ -263,7 +263,7 @@ BOOST_MP_FORCEINLINE typename enable_if_c< >::type eval_multiply( cpp_int_backend& result, - const cpp_int_backend& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { *result.limbs() = detail::checked_multiply(*result.limbs(), *o.limbs(), typename cpp_int_backend::checked_type()); result.sign(result.sign() != o.sign()); @@ -277,7 +277,7 @@ BOOST_MP_FORCEINLINE typename enable_if_c< >::type eval_multiply( cpp_int_backend& result, - const cpp_int_backend& o) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { *result.limbs() = detail::checked_multiply(*result.limbs(), *o.limbs(), typename cpp_int_backend::checked_type()); result.normalize(); @@ -293,7 +293,7 @@ BOOST_MP_FORCEINLINE typename enable_if_c< eval_multiply( cpp_int_backend& result, const cpp_int_backend& a, - const cpp_int_backend& b) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& b) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { *result.limbs() = detail::checked_multiply(*a.limbs(), *b.limbs(), typename cpp_int_backend::checked_type()); result.sign(a.sign() != b.sign()); @@ -308,7 +308,7 @@ BOOST_MP_FORCEINLINE typename enable_if_c< eval_multiply( cpp_int_backend& result, const cpp_int_backend& a, - const cpp_int_backend& b) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) + const cpp_int_backend& b) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int >::value)) { *result.limbs() = detail::checked_multiply(*a.limbs(), *b.limbs(), typename cpp_int_backend::checked_type()); result.normalize(); diff --git a/include/boost/multiprecision/detail/number_base.hpp b/include/boost/multiprecision/detail/number_base.hpp index e8cb5c76..bb77702e 100644 --- a/include/boost/multiprecision/detail/number_base.hpp +++ b/include/boost/multiprecision/detail/number_base.hpp @@ -25,6 +25,12 @@ # define BOOST_MP_FORCEINLINE inline #endif +#if defined(BOOST_GCC) && (BOOST_GCC <= 40700) +# define BOOST_MP_NOEXCEPT_IF(x) +#else +# define BOOST_MP_NOEXCEPT_IF(x) BOOST_NOEXCEPT_IF(x) +#endif + #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable:6326) diff --git a/include/boost/multiprecision/number.hpp b/include/boost/multiprecision/number.hpp index adf09b1f..9d8b64b2 100644 --- a/include/boost/multiprecision/number.hpp +++ b/include/boost/multiprecision/number.hpp @@ -41,8 +41,8 @@ class number typedef number self_type; public: typedef Backend backend_type; - BOOST_MP_FORCEINLINE BOOST_CONSTEXPR number() BOOST_NOEXCEPT_IF(noexcept(Backend())) {} - BOOST_MP_FORCEINLINE BOOST_CONSTEXPR number(const number& e) BOOST_NOEXCEPT_IF(noexcept(Backend(std::declval()))) : m_backend(e.m_backend){} + BOOST_MP_FORCEINLINE BOOST_CONSTEXPR number() BOOST_MP_NOEXCEPT_IF(noexcept(Backend())) {} + BOOST_MP_FORCEINLINE BOOST_CONSTEXPR number(const number& e) BOOST_MP_NOEXCEPT_IF(noexcept(Backend(std::declval()))) : m_backend(e.m_backend){} template BOOST_MP_FORCEINLINE number(const V& v, typename boost::enable_if_c< (boost::is_arithmetic::value || is_same::value || is_convertible::value) @@ -58,11 +58,11 @@ public: && !detail::is_restricted_conversion::type, Backend>::value >::type* = 0) #ifndef BOOST_INTEL - BOOST_NOEXCEPT_IF(noexcept(Backend(std::declval::type const&>()))) + BOOST_MP_NOEXCEPT_IF(noexcept(Backend(std::declval::type const&>()))) #endif : m_backend(canonical_value(v)) {} BOOST_MP_FORCEINLINE BOOST_CONSTEXPR number(const number& e, unsigned digits10) - BOOST_NOEXCEPT_IF(noexcept(Backend(std::declval(), std::declval()))) + BOOST_MP_NOEXCEPT_IF(noexcept(Backend(std::declval(), std::declval()))) : m_backend(e.m_backend, digits10){} template explicit BOOST_MP_FORCEINLINE number(const V& v, typename boost::enable_if_c< @@ -70,7 +70,7 @@ public: && !detail::is_explicitly_convertible::type, Backend>::value && detail::is_restricted_conversion::type, Backend>::value >::type* = 0) - BOOST_NOEXCEPT_IF(noexcept(std::declval() = std::declval::type const&>())) + BOOST_MP_NOEXCEPT_IF(noexcept(std::declval() = std::declval::type const&>())) { m_backend = canonical_value(v); } @@ -80,7 +80,7 @@ public: && (detail::is_restricted_conversion::type, Backend>::value || !is_convertible::type, Backend>::value) >::type* = 0) - BOOST_NOEXCEPT_IF(noexcept(Backend(std::declval::type const&>()))) + BOOST_MP_NOEXCEPT_IF(noexcept(Backend(std::declval::type const&>()))) : m_backend(canonical_value(v)) {} /* // @@ -96,12 +96,12 @@ public: */ template BOOST_MP_FORCEINLINE BOOST_CONSTEXPR number(const number& val) - BOOST_NOEXCEPT_IF(noexcept(Backend(std::declval()))) : m_backend(val.backend()) {} + BOOST_MP_NOEXCEPT_IF(noexcept(Backend(std::declval()))) : m_backend(val.backend()) {} template BOOST_MP_FORCEINLINE number(const number& val, typename boost::enable_if_c<(boost::is_convertible::value && !detail::is_restricted_conversion::value)>::type* = 0) - BOOST_NOEXCEPT_IF(noexcept(Backend(std::declval()))) + BOOST_MP_NOEXCEPT_IF(noexcept(Backend(std::declval()))) : m_backend(val.backend()) {} template @@ -118,7 +118,7 @@ public: explicit BOOST_MP_FORCEINLINE number(const number& val, typename boost::enable_if_c< (detail::is_explicitly_convertible::value && (detail::is_restricted_conversion::value || !boost::is_convertible::value)) - >::type* = 0) BOOST_NOEXCEPT_IF(noexcept(Backend(std::declval()))) + >::type* = 0) BOOST_MP_NOEXCEPT_IF(noexcept(Backend(std::declval()))) : m_backend(val.backend()) {} template @@ -150,7 +150,7 @@ public: } BOOST_MP_FORCEINLINE number& operator=(const number& e) - BOOST_NOEXCEPT_IF(noexcept(std::declval() = std::declval())) + BOOST_MP_NOEXCEPT_IF(noexcept(std::declval() = std::declval())) { m_backend = e.m_backend; return *this; @@ -159,14 +159,14 @@ public: template BOOST_MP_FORCEINLINE typename boost::enable_if, number& >::type operator=(const V& v) - BOOST_NOEXCEPT_IF(noexcept(std::declval() = std::declval::type&>())) + BOOST_MP_NOEXCEPT_IF(noexcept(std::declval() = std::declval::type&>())) { m_backend = canonical_value(v); return *this; } template BOOST_MP_FORCEINLINE number& assign(const V& v) - BOOST_NOEXCEPT_IF(noexcept(std::declval() = std::declval::type&>())) + BOOST_MP_NOEXCEPT_IF(noexcept(std::declval() = std::declval::type&>())) { m_backend = canonical_value(v); return *this; @@ -197,9 +197,9 @@ public: #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES BOOST_MP_FORCEINLINE BOOST_CONSTEXPR number(number&& r) - BOOST_NOEXCEPT_IF(noexcept(Backend(std::declval()))) + BOOST_MP_NOEXCEPT_IF(noexcept(Backend(std::declval()))) : m_backend(static_cast(r.m_backend)){} - BOOST_MP_FORCEINLINE number& operator=(number&& r) BOOST_NOEXCEPT_IF(noexcept(std::declval() = std::declval())) + BOOST_MP_FORCEINLINE number& operator=(number&& r) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval() = std::declval())) { m_backend = static_cast(r.m_backend); return *this; @@ -548,7 +548,7 @@ public: // // swap: // - BOOST_MP_FORCEINLINE void swap(self_type& other) BOOST_NOEXCEPT_IF(noexcept(std::declval().swap(std::declval()))) + BOOST_MP_FORCEINLINE void swap(self_type& other) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval().swap(std::declval()))) { m_backend.swap(other.backend()); } @@ -665,7 +665,7 @@ public: // Comparison: // BOOST_MP_FORCEINLINE int compare(const number& o)const - BOOST_NOEXCEPT_IF(noexcept(std::declval().compare(std::declval()))) + BOOST_MP_NOEXCEPT_IF(noexcept(std::declval().compare(std::declval()))) { return m_backend.compare(o.m_backend); } @@ -1784,7 +1784,7 @@ inline std::istream& operator >> (std::istream& is, number BOOST_MP_FORCEINLINE void swap(number& a, number& b) - BOOST_NOEXCEPT_IF(noexcept(std::declval&>() = std::declval&>())) + BOOST_MP_NOEXCEPT_IF(noexcept(std::declval&>() = std::declval&>())) { a.swap(b); } diff --git a/include/boost/multiprecision/rational_adaptor.hpp b/include/boost/multiprecision/rational_adaptor.hpp index 16fd940a..e3cec0e4 100644 --- a/include/boost/multiprecision/rational_adaptor.hpp +++ b/include/boost/multiprecision/rational_adaptor.hpp @@ -34,12 +34,12 @@ struct rational_adaptor typedef typename IntBackend::unsigned_types unsigned_types; typedef typename IntBackend::float_types float_types; - rational_adaptor() BOOST_NOEXCEPT_IF(noexcept(rational_type())) {} - rational_adaptor(const rational_adaptor& o) BOOST_NOEXCEPT_IF(noexcept(std::declval() = std::declval())) + rational_adaptor() BOOST_MP_NOEXCEPT_IF(noexcept(rational_type())) {} + rational_adaptor(const rational_adaptor& o) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval() = std::declval())) { m_value = o.m_value; } - rational_adaptor(const IntBackend& o) BOOST_NOEXCEPT_IF(noexcept(rational_type(std::declval()))) : m_value(o) {} + rational_adaptor(const IntBackend& o) BOOST_MP_NOEXCEPT_IF(noexcept(rational_type(std::declval()))) : m_value(o) {} template rational_adaptor(const U& u, typename enable_if_c::value>::type* = 0) @@ -57,9 +57,9 @@ struct rational_adaptor } #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - rational_adaptor(rational_adaptor&& o) BOOST_NOEXCEPT_IF(noexcept(rational_type(std::declval()))) : m_value(static_cast(o.m_value)) {} - rational_adaptor(IntBackend&& o) BOOST_NOEXCEPT_IF(noexcept(rational_type(std::declval()))) : m_value(static_cast(o)) {} - rational_adaptor& operator = (rational_adaptor&& o) BOOST_NOEXCEPT_IF(noexcept(std::declval() = std::declval())) + rational_adaptor(rational_adaptor&& o) BOOST_MP_NOEXCEPT_IF(noexcept(rational_type(std::declval()))) : m_value(static_cast(o.m_value)) {} + rational_adaptor(IntBackend&& o) BOOST_MP_NOEXCEPT_IF(noexcept(rational_type(std::declval()))) : m_value(static_cast(o)) {} + rational_adaptor& operator = (rational_adaptor&& o) BOOST_MP_NOEXCEPT_IF(noexcept(std::declval() = std::declval())) { m_value = static_cast(o.m_value); return *this;