]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/multiprecision/detail/no_et_ops.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / multiprecision / detail / no_et_ops.hpp
index 61d5249ed25264b8d9a69a3a16d7b5edd0e81d24..4fc0e97b354d92a34292214cfdd3dcbd3144b5bc 100644 (file)
@@ -22,7 +22,7 @@ namespace boost {
       template <class B>
       BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number<B, et_off> operator-(const number<B, et_off>& v)
       {
-         BOOST_STATIC_ASSERT_MSG(is_signed_number<B>::value, "Negating an unsigned type results in ill-defined behavior.");
+         static_assert(is_signed_number<B>::value, "Negating an unsigned type results in ill-defined behavior.");
          detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(v);
          number<B, et_off>                                                    result(v);
          result.backend().negate();
@@ -49,20 +49,20 @@ namespace boost {
          return result;
       }
       template <class B, class V>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value, number<B, et_off> >::type
          operator+(const number<B, et_off>& a, const V& b)
       {
-         detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a);
+         detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
          number<B, et_off>                                                    result;
          using default_ops::eval_add;
          eval_add(result.backend(), a.backend(), number<B, et_off>::canonical_value(b));
          return result;
       }
       template <class V, class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value && !is_equivalent_number_type<V, B>::value, number<B, et_off> >::type
          operator+(const V& a, const number<B, et_off>& b)
       {
-         detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(b);
+         detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(b, a);
          number<B, et_off>                                                    result;
          using default_ops::eval_add;
          eval_add(result.backend(), b.backend(), number<B, et_off>::canonical_value(a));
@@ -81,20 +81,20 @@ namespace boost {
          return result;
       }
       template <class B, class V>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value, number<B, et_off> >::type
          operator-(const number<B, et_off>& a, const V& b)
       {
-         detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a);
+         detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
          number<B, et_off>                                                    result;
          using default_ops::eval_subtract;
          eval_subtract(result.backend(), a.backend(), number<B, et_off>::canonical_value(b));
          return result;
       }
       template <class V, class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value && !is_equivalent_number_type<V, B>::value, number<B, et_off> >::type
          operator-(const V& a, const number<B, et_off>& b)
       {
-         detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(b);
+         detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(b, a);
          number<B, et_off>                                                    result;
          using default_ops::eval_subtract;
          eval_subtract(result.backend(), number<B, et_off>::canonical_value(a), b.backend());
@@ -113,20 +113,20 @@ namespace boost {
          return result;
       }
       template <class B, class V>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value, number<B, et_off> >::type
          operator*(const number<B, et_off>& a, const V& b)
       {
-         detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a);
+         detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
          number<B, et_off>                                                    result;
          using default_ops::eval_multiply;
          eval_multiply(result.backend(), a.backend(), number<B, et_off>::canonical_value(b));
          return result;
       }
       template <class V, class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value && !is_equivalent_number_type<V, B>::value, number<B, et_off> >::type
          operator*(const V& a, const number<B, et_off>& b)
       {
-         detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(b);
+         detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(b, a);
          number<B, et_off>                                                    result;
          using default_ops::eval_multiply;
          eval_multiply(result.backend(), b.backend(), number<B, et_off>::canonical_value(a));
@@ -145,20 +145,20 @@ namespace boost {
          return result;
       }
       template <class B, class V>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value, number<B, et_off> >::type
          operator/(const number<B, et_off>& a, const V& b)
       {
-         detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a);
+         detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
          number<B, et_off>                                                    result;
          using default_ops::eval_divide;
          eval_divide(result.backend(), a.backend(), number<B, et_off>::canonical_value(b));
          return result;
       }
       template <class V, class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value && !is_equivalent_number_type<V, B>::value, number<B, et_off> >::type
          operator/(const V& a, const number<B, et_off>& b)
       {
-         detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(b);
+         detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(b, a);
          number<B, et_off>                                                    result;
          using default_ops::eval_divide;
          eval_divide(result.backend(), number<B, et_off>::canonical_value(a), b.backend());
@@ -168,7 +168,7 @@ namespace boost {
       // modulus:
       //
       template <class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator%(const number<B, et_off>& a, const number<B, et_off>& b)
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator%(const number<B, et_off>& a, const number<B, et_off>& b)
       {
          detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
          number<B, et_off>                                                    result;
@@ -177,7 +177,7 @@ namespace boost {
          return result;
       }
       template <class B, class V>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
          operator%(const number<B, et_off>& a, const V& b)
       {
          detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a);
@@ -187,7 +187,7 @@ namespace boost {
          return result;
       }
       template <class V, class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer) && !is_equivalent_number_type<V, B>::value, number<B, et_off> >::type
          operator%(const V& a, const number<B, et_off>& b)
       {
          detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(b);
@@ -200,7 +200,7 @@ namespace boost {
       // Bitwise or:
       //
       template <class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator|(const number<B, et_off>& a, const number<B, et_off>& b)
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator|(const number<B, et_off>& a, const number<B, et_off>& b)
       {
          number<B, et_off> result;
          using default_ops::eval_bitwise_or;
@@ -208,7 +208,7 @@ namespace boost {
          return result;
       }
       template <class B, class V>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
          operator|(const number<B, et_off>& a, const V& b)
       {
          number<B, et_off> result;
@@ -217,7 +217,7 @@ namespace boost {
          return result;
       }
       template <class V, class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer) && !is_equivalent_number_type<V, B>::value, number<B, et_off> >::type
          operator|(const V& a, const number<B, et_off>& b)
       {
          number<B, et_off> result;
@@ -229,7 +229,7 @@ namespace boost {
       // Bitwise xor:
       //
       template <class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator^(const number<B, et_off>& a, const number<B, et_off>& b)
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator^(const number<B, et_off>& a, const number<B, et_off>& b)
       {
          number<B, et_off> result;
          using default_ops::eval_bitwise_xor;
@@ -237,7 +237,7 @@ namespace boost {
          return result;
       }
       template <class B, class V>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
          operator^(const number<B, et_off>& a, const V& b)
       {
          number<B, et_off> result;
@@ -246,7 +246,7 @@ namespace boost {
          return result;
       }
       template <class V, class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer) && !is_equivalent_number_type<V, B>::value, number<B, et_off> >::type
          operator^(const V& a, const number<B, et_off>& b)
       {
          number<B, et_off> result;
@@ -258,7 +258,7 @@ namespace boost {
       // Bitwise and:
       //
       template <class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator&(const number<B, et_off>& a, const number<B, et_off>& b)
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator&(const number<B, et_off>& a, const number<B, et_off>& b)
       {
          number<B, et_off> result;
          using default_ops::eval_bitwise_and;
@@ -266,7 +266,7 @@ namespace boost {
          return result;
       }
       template <class B, class V>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
          operator&(const number<B, et_off>& a, const V& b)
       {
          number<B, et_off> result;
@@ -275,7 +275,7 @@ namespace boost {
          return result;
       }
       template <class V, class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer) && !is_equivalent_number_type<V, B>::value, number<B, et_off> >::type
          operator&(const V& a, const number<B, et_off>& b)
       {
          number<B, et_off> result;
@@ -287,27 +287,26 @@ namespace boost {
       // shifts:
       //
       template <class B, class I>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_integral<I>::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<boost::multiprecision::detail::is_integral<I>::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
          operator<<(const number<B, et_off>& a, const I& b)
       {
          number<B, et_off> result(a);
          using default_ops::eval_left_shift;
-         detail::check_shift_range(b, mpl::bool_<(sizeof(I) > sizeof(std::size_t))>(), mpl::bool_<is_signed<I>::value>());
+         detail::check_shift_range(b, std::integral_constant<bool, (sizeof(I) > sizeof(std::size_t))>(), std::integral_constant<bool, boost::multiprecision::detail::is_signed<I>::value>());
          eval_left_shift(result.backend(), b);
          return result;
       }
       template <class B, class I>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_integral<I>::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<boost::multiprecision::detail::is_integral<I>::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
          operator>>(const number<B, et_off>& a, const I& b)
       {
          number<B, et_off> result(a);
          using default_ops::eval_right_shift;
-         detail::check_shift_range(b, mpl::bool_<(sizeof(I) > sizeof(std::size_t))>(), mpl::bool_<is_signed<I>::value>());
+         detail::check_shift_range(b, std::integral_constant<bool, (sizeof(I) > sizeof(std::size_t))>(), std::integral_constant<bool, boost::multiprecision::detail::is_signed<I>::value>());
          eval_right_shift(result.backend(), b);
          return result;
       }
 
-#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !(defined(__GNUC__) && ((__GNUC__ == 4) && (__GNUC_MINOR__ < 5)))
       //
       // If we have rvalue references go all over again with rvalue ref overloads and move semantics.
       // Note that while it would be tempting to implement these so they return an rvalue reference
@@ -322,15 +321,15 @@ namespace boost {
       template <class B>
       BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number<B, et_off> operator-(number<B, et_off>&& v)
       {
-         BOOST_STATIC_ASSERT_MSG(is_signed_number<B>::value, "Negating an unsigned type results in ill-defined behavior.");
+         static_assert(is_signed_number<B>::value, "Negating an unsigned type results in ill-defined behavior.");
          v.backend().negate();
-         return static_cast<number<B, et_off>&&>(v);
+         return std::move(v);
       }
       template <class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator~(number<B, et_off>&& v)
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator~(number<B, et_off>&& v)
       {
          eval_complement(v.backend(), v.backend());
-         return static_cast<number<B, et_off>&&>(v);
+         return std::move(v);
       }
       //
       // Addition:
@@ -341,7 +340,7 @@ namespace boost {
          using default_ops::eval_add;
          detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
          eval_add(a.backend(), b.backend());
-         return static_cast<number<B, et_off>&&>(a);
+         return std::move(a);
       }
       template <class B>
       BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number<B, et_off> operator+(const number<B, et_off>& a, number<B, et_off>&& b)
@@ -349,7 +348,7 @@ namespace boost {
          using default_ops::eval_add;
          detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
          eval_add(b.backend(), a.backend());
-         return static_cast<number<B, et_off>&&>(b);
+         return std::move(b);
       }
       template <class B>
       BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number<B, et_off> operator+(number<B, et_off>&& a, number<B, et_off>&& b)
@@ -357,25 +356,25 @@ namespace boost {
          using default_ops::eval_add;
          detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
          eval_add(a.backend(), b.backend());
-         return static_cast<number<B, et_off>&&>(a);
+         return std::move(a);
       }
       template <class B, class V>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value, number<B, et_off> >::type
          operator+(number<B, et_off>&& a, const V& b)
       {
          using default_ops::eval_add;
          detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
          eval_add(a.backend(), number<B, et_off>::canonical_value(b));
-         return static_cast<number<B, et_off>&&>(a);
+         return std::move(a);
       }
       template <class V, class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value && !is_equivalent_number_type<V, B>::value, number<B, et_off> >::type
          operator+(const V& a, number<B, et_off>&& b)
       {
          using default_ops::eval_add;
          detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
          eval_add(b.backend(), number<B, et_off>::canonical_value(a));
-         return static_cast<number<B, et_off>&&>(b);
+         return std::move(b);
       }
       //
       // Subtraction:
@@ -386,16 +385,16 @@ namespace boost {
          using default_ops::eval_subtract;
          detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
          eval_subtract(a.backend(), b.backend());
-         return static_cast<number<B, et_off>&&>(a);
+         return std::move(a);
       }
       template <class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_signed_number<B>, number<B, et_off> >::type operator-(const number<B, et_off>& a, number<B, et_off>&& b)
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_signed_number<B>::value, number<B, et_off> >::type operator-(const number<B, et_off>& a, number<B, et_off>&& b)
       {
          using default_ops::eval_subtract;
          detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
          eval_subtract(b.backend(), a.backend());
          b.backend().negate();
-         return static_cast<number<B, et_off>&&>(b);
+         return std::move(b);
       }
       template <class B>
       BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number<B, et_off> operator-(number<B, et_off>&& a, number<B, et_off>&& b)
@@ -403,26 +402,26 @@ namespace boost {
          using default_ops::eval_subtract;
          detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
          eval_subtract(a.backend(), b.backend());
-         return static_cast<number<B, et_off>&&>(a);
+         return std::move(a);
       }
       template <class B, class V>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value, number<B, et_off> >::type
          operator-(number<B, et_off>&& a, const V& b)
       {
          using default_ops::eval_subtract;
          detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
          eval_subtract(a.backend(), number<B, et_off>::canonical_value(b));
-         return static_cast<number<B, et_off>&&>(a);
+         return std::move(a);
       }
       template <class V, class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<(is_compatible_arithmetic_type<V, number<B, et_off> >::value && is_signed_number<B>::value), number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<(is_compatible_arithmetic_type<V, number<B, et_off> >::value && is_signed_number<B>::value) && !is_equivalent_number_type<V, B>::value, number<B, et_off> >::type
          operator-(const V& a, number<B, et_off>&& b)
       {
          using default_ops::eval_subtract;
          detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
          eval_subtract(b.backend(), number<B, et_off>::canonical_value(a));
          b.backend().negate();
-         return static_cast<number<B, et_off>&&>(b);
+         return std::move(b);
       }
       //
       // Multiply:
@@ -433,7 +432,7 @@ namespace boost {
          using default_ops::eval_multiply;
          detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
          eval_multiply(a.backend(), b.backend());
-         return static_cast<number<B, et_off>&&>(a);
+         return std::move(a);
       }
       template <class B>
       BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number<B, et_off> operator*(const number<B, et_off>& a, number<B, et_off>&& b)
@@ -441,7 +440,7 @@ namespace boost {
          using default_ops::eval_multiply;
          detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
          eval_multiply(b.backend(), a.backend());
-         return static_cast<number<B, et_off>&&>(b);
+         return std::move(b);
       }
       template <class B>
       BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR number<B, et_off> operator*(number<B, et_off>&& a, number<B, et_off>&& b)
@@ -449,25 +448,25 @@ namespace boost {
          using default_ops::eval_multiply;
          detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
          eval_multiply(a.backend(), b.backend());
-         return static_cast<number<B, et_off>&&>(a);
+         return std::move(a);
       }
       template <class B, class V>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value, number<B, et_off> >::type
          operator*(number<B, et_off>&& a, const V& b)
       {
          using default_ops::eval_multiply;
          detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
          eval_multiply(a.backend(), number<B, et_off>::canonical_value(b));
-         return static_cast<number<B, et_off>&&>(a);
+         return std::move(a);
       }
       template <class V, class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value && !is_equivalent_number_type<V, B>::value, number<B, et_off> >::type
          operator*(const V& a, number<B, et_off>&& b)
       {
          using default_ops::eval_multiply;
          detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
          eval_multiply(b.backend(), number<B, et_off>::canonical_value(a));
-         return static_cast<number<B, et_off>&&>(b);
+         return std::move(b);
       }
       //
       // divide:
@@ -478,178 +477,177 @@ namespace boost {
          using default_ops::eval_divide;
          detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
          eval_divide(a.backend(), b.backend());
-         return static_cast<number<B, et_off>&&>(a);
+         return std::move(a);
       }
       template <class B, class V>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >, number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value, number<B, et_off> >::type
          operator/(number<B, et_off>&& a, const V& b)
       {
          using default_ops::eval_divide;
          detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
          eval_divide(a.backend(), number<B, et_off>::canonical_value(b));
-         return static_cast<number<B, et_off>&&>(a);
+         return std::move(a);
       }
       //
       // modulus:
       //
       template <class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator%(number<B, et_off>&& a, const number<B, et_off>& b)
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator%(number<B, et_off>&& a, const number<B, et_off>& b)
       {
          using default_ops::eval_modulus;
          detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
          eval_modulus(a.backend(), b.backend());
-         return static_cast<number<B, et_off>&&>(a);
+         return std::move(a);
       }
       template <class B, class V>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
          operator%(number<B, et_off>&& a, const V& b)
       {
          using default_ops::eval_modulus;
          detail::scoped_default_precision<multiprecision::number<B, et_off> > precision_guard(a, b);
          eval_modulus(a.backend(), number<B, et_off>::canonical_value(b));
-         return static_cast<number<B, et_off>&&>(a);
+         return std::move(a);
       }
       //
       // Bitwise or:
       //
       template <class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator|(number<B, et_off>&& a, const number<B, et_off>& b)
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator|(number<B, et_off>&& a, const number<B, et_off>& b)
       {
          using default_ops::eval_bitwise_or;
          eval_bitwise_or(a.backend(), b.backend());
-         return static_cast<number<B, et_off>&&>(a);
+         return std::move(a);
       }
       template <class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator|(const number<B, et_off>& a, number<B, et_off>&& b)
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator|(const number<B, et_off>& a, number<B, et_off>&& b)
       {
          using default_ops::eval_bitwise_or;
          eval_bitwise_or(b.backend(), a.backend());
-         return static_cast<number<B, et_off>&&>(b);
+         return std::move(b);
       }
       template <class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator|(number<B, et_off>&& a, number<B, et_off>&& b)
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator|(number<B, et_off>&& a, number<B, et_off>&& b)
       {
          using default_ops::eval_bitwise_or;
          eval_bitwise_or(a.backend(), b.backend());
-         return static_cast<number<B, et_off>&&>(a);
+         return std::move(a);
       }
       template <class B, class V>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
          operator|(number<B, et_off>&& a, const V& b)
       {
          using default_ops::eval_bitwise_or;
          eval_bitwise_or(a.backend(), number<B, et_off>::canonical_value(b));
-         return static_cast<number<B, et_off>&&>(a);
+         return std::move(a);
       }
       template <class V, class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer) && !is_equivalent_number_type<V, B>::value, number<B, et_off> >::type
          operator|(const V& a, number<B, et_off>&& b)
       {
          using default_ops::eval_bitwise_or;
          eval_bitwise_or(b.backend(), number<B, et_off>::canonical_value(a));
-         return static_cast<number<B, et_off>&&>(b);
+         return std::move(b);
       }
       //
       // Bitwise xor:
       //
       template <class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator^(number<B, et_off>&& a, const number<B, et_off>& b)
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator^(number<B, et_off>&& a, const number<B, et_off>& b)
       {
          using default_ops::eval_bitwise_xor;
          eval_bitwise_xor(a.backend(), b.backend());
-         return static_cast<number<B, et_off>&&>(a);
+         return std::move(a);
       }
       template <class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator^(const number<B, et_off>& a, number<B, et_off>&& b)
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator^(const number<B, et_off>& a, number<B, et_off>&& b)
       {
          using default_ops::eval_bitwise_xor;
          eval_bitwise_xor(b.backend(), a.backend());
-         return static_cast<number<B, et_off>&&>(b);
+         return std::move(b);
       }
       template <class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator^(number<B, et_off>&& a, number<B, et_off>&& b)
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator^(number<B, et_off>&& a, number<B, et_off>&& b)
       {
          using default_ops::eval_bitwise_xor;
          eval_bitwise_xor(a.backend(), b.backend());
-         return static_cast<number<B, et_off>&&>(a);
+         return std::move(a);
       }
       template <class B, class V>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
          operator^(number<B, et_off>&& a, const V& b)
       {
          using default_ops::eval_bitwise_xor;
          eval_bitwise_xor(a.backend(), number<B, et_off>::canonical_value(b));
-         return static_cast<number<B, et_off>&&>(a);
+         return std::move(a);
       }
       template <class V, class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer) && !is_equivalent_number_type<V, B>::value, number<B, et_off> >::type
          operator^(const V& a, number<B, et_off>&& b)
       {
          using default_ops::eval_bitwise_xor;
          eval_bitwise_xor(b.backend(), number<B, et_off>::canonical_value(a));
-         return static_cast<number<B, et_off>&&>(b);
+         return std::move(b);
       }
       //
       // Bitwise and:
       //
       template <class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator&(number<B, et_off>&& a, const number<B, et_off>& b)
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator&(number<B, et_off>&& a, const number<B, et_off>& b)
       {
          using default_ops::eval_bitwise_and;
          eval_bitwise_and(a.backend(), b.backend());
-         return static_cast<number<B, et_off>&&>(a);
+         return std::move(a);
       }
       template <class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator&(const number<B, et_off>& a, number<B, et_off>&& b)
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator&(const number<B, et_off>& a, number<B, et_off>&& b)
       {
          using default_ops::eval_bitwise_and;
          eval_bitwise_and(b.backend(), a.backend());
-         return static_cast<number<B, et_off>&&>(b);
+         return std::move(b);
       }
       template <class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator&(number<B, et_off>&& a, number<B, et_off>&& b)
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<number_category<B>::value == number_kind_integer, number<B, et_off> >::type operator&(number<B, et_off>&& a, number<B, et_off>&& b)
       {
          using default_ops::eval_bitwise_and;
          eval_bitwise_and(a.backend(), b.backend());
-         return static_cast<number<B, et_off>&&>(a);
+         return std::move(a);
       }
       template <class B, class V>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
          operator&(number<B, et_off>&& a, const V& b)
       {
          using default_ops::eval_bitwise_and;
          eval_bitwise_and(a.backend(), number<B, et_off>::canonical_value(b));
-         return static_cast<number<B, et_off>&&>(a);
+         return std::move(a);
       }
       template <class V, class B>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<is_compatible_arithmetic_type<V, number<B, et_off> >::value && (number_category<B>::value == number_kind_integer) && !is_equivalent_number_type<V, B>::value, number<B, et_off> >::type
          operator&(const V& a, number<B, et_off>&& b)
       {
          using default_ops::eval_bitwise_and;
          eval_bitwise_and(b.backend(), number<B, et_off>::canonical_value(a));
-         return static_cast<number<B, et_off>&&>(b);
+         return std::move(b);
       }
       //
       // shifts:
       //
       template <class B, class I>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_integral<I>::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<boost::multiprecision::detail::is_integral<I>::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
          operator<<(number<B, et_off>&& a, const I& b)
       {
          using default_ops::eval_left_shift;
          eval_left_shift(a.backend(), b);
-         return static_cast<number<B, et_off>&&>(a);
+         return std::move(a);
       }
       template <class B, class I>
-      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename enable_if_c<is_integral<I>::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
+      BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<boost::multiprecision::detail::is_integral<I>::value && (number_category<B>::value == number_kind_integer), number<B, et_off> >::type
          operator>>(number<B, et_off>&& a, const I& b)
       {
          using default_ops::eval_right_shift;
          eval_right_shift(a.backend(), b);
-         return static_cast<number<B, et_off>&&>(a);
+         return std::move(a);
       }
 
-#endif
 
    }
 } // namespace boost::multiprecision