]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/multiprecision/debug_adaptor.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / multiprecision / debug_adaptor.hpp
index cb61c5b59b6d4eb0ac76fa455e844e8aa8310feb..826c76d74de6557ea1a21860c1e38a9916f3958c 100644 (file)
@@ -1,7 +1,7 @@
 ///////////////////////////////////////////////////////////////
 //  Copyright 2012 John Maddock. Distributed under the Boost
 //  Software License, Version 1.0. (See accompanying file
-//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
+//  LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
 
 #ifndef BOOST_MATH_DEBUG_ADAPTER_HPP
 #define BOOST_MATH_DEBUG_ADAPTER_HPP
@@ -9,28 +9,29 @@
 #include <boost/multiprecision/traits/extract_exponent_type.hpp>
 #include <boost/multiprecision/detail/integer_ops.hpp>
 
-namespace boost{
-namespace multiprecision{
-namespace backends{
+namespace boost {
+namespace multiprecision {
+namespace backends {
 
 #ifdef BOOST_MSVC
 #pragma warning(push)
-#pragma warning(disable:4127) // conditional expression is constant
+#pragma warning(disable : 4127) // conditional expression is constant
 #endif
-   
-   template <class Backend>
+
+template <class Backend>
 struct debug_adaptor
 {
-   typedef typename Backend::signed_types              signed_types;
-   typedef typename Backend::unsigned_types            unsigned_types;
-   typedef typename Backend::float_types               float_types;
+   typedef typename Backend::signed_types   signed_types;
+   typedef typename Backend::unsigned_types unsigned_types;
+   typedef typename Backend::float_types    float_types;
    typedef typename extract_exponent_type<
-      Backend, number_category<Backend>::value>::type  exponent_type;
+       Backend, number_category<Backend>::value>::type exponent_type;
 
-private:
+ private:
    std::string debug_value;
-   Backend m_value;
-public:
+   Backend     m_value;
+
+ public:
    void update_view()
    {
 #ifndef BOOST_NO_EXCEPTIONS
@@ -40,7 +41,7 @@ public:
          debug_value = m_value.str(0, static_cast<std::ios_base::fmtflags>(0));
 #ifndef BOOST_NO_EXCEPTIONS
       }
-      catch(const std::exception& e)
+      catch (const std::exception& e)
       {
          debug_value = "String conversion failed with message: \"";
          debug_value += e.what();
@@ -55,32 +56,32 @@ public:
    debug_adaptor(const debug_adaptor& o) : debug_value(o.debug_value), m_value(o.m_value)
    {
    }
-   debug_adaptor& operator = (const debug_adaptor& o)
+   debug_adaptor& operator=(const debug_adaptor& o)
    {
       debug_value = o.debug_value;
-      m_value = o.m_value;
+      m_value     = o.m_value;
       return *this;
    }
    template <class T>
    debug_adaptor(const T& i, const typename enable_if_c<is_convertible<T, Backend>::value>::type* = 0)
-      : m_value(i)
+       : m_value(i)
    {
       update_view();
    }
    template <class T>
    debug_adaptor(const T& i, const T& j)
-      : m_value(i, j)
+       : m_value(i, j)
    {
       update_view();
    }
    template <class T>
-   typename enable_if_c<is_arithmetic<T>::value || is_convertible<T, Backend>::value, debug_adaptor&>::type operator = (const T& i)
+   typename enable_if_c<is_arithmetic<T>::value || is_convertible<T, Backend>::value, debug_adaptor&>::type operator=(const T& i)
    {
       m_value = i;
       update_view();
       return *this;
    }
-   debug_adaptor& operator = (const char* s)
+   debug_adaptor& operator=(const char* s)
    {
       m_value = s;
       update_view();
@@ -91,7 +92,7 @@ public:
       std::swap(m_value, o.value());
       std::swap(debug_value, o.debug_value);
    }
-   std::string str(std::streamsize digits, std::ios_base::fmtflags f)const
+   std::string str(std::streamsize digits, std::ios_base::fmtflags f) const
    {
       return m_value.str(digits, f);
    }
@@ -100,12 +101,12 @@ public:
       m_value.negate();
       update_view();
    }
-   int compare(const debug_adaptor& o)const
+   int compare(const debug_adaptor& o) const
    {
       return m_value.compare(o.value());
    }
    template <class T>
-   int compare(const T& i)const
+   int compare(const T& i) const
    {
       return m_value.compare(i);
    }
@@ -113,16 +114,16 @@ public:
    {
       return m_value;
    }
-   const Backend& value()const
+   const Backend& value() const
    {
       return m_value;
    }
    template <class Archive>
    void serialize(Archive& ar, const unsigned int /*version*/)
    {
-      ar & m_value;
+      ar & boost::make_nvp("value", m_value);
       typedef typename Archive::is_loading tag;
-      if(tag::value)
+      if (tag::value)
          update_view();
    }
    static unsigned default_precision() BOOST_NOEXCEPT
@@ -133,7 +134,7 @@ public:
    {
       Backend::default_precision(v);
    }
-   unsigned precision()const BOOST_NOEXCEPT
+   unsigned precision() const BOOST_NOEXCEPT
    {
       return value().precision();
    }
@@ -154,104 +155,117 @@ inline const T& unwrap_debug_type(const T& val)
    return val;
 }
 
-#define NON_MEMBER_OP1(name, str) \
-   template <class Backend>\
-   inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result)\
-   {\
-      using default_ops::BOOST_JOIN(eval_, name);\
-      BOOST_JOIN(eval_, name)(result.value());\
-      result.update_view();\
+#define NON_MEMBER_OP1(name, str)                                       \
+   template <class Backend>                                             \
+   inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend> & result) \
+   {                                                                    \
+      using default_ops::BOOST_JOIN(eval_, name);                       \
+      BOOST_JOIN(eval_, name)                                           \
+      (result.value());                                                 \
+      result.update_view();                                             \
    }
 
-#define NON_MEMBER_OP2(name, str) \
-   template <class Backend, class T>\
-   inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const T& a)\
-   {\
-      using default_ops::BOOST_JOIN(eval_, name);\
-      BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a));\
-      result.update_view();\
-   }\
-   template <class Backend>\
-   inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const debug_adaptor<Backend>& a)\
-   {\
-      using default_ops::BOOST_JOIN(eval_, name);\
-      BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a));\
-      result.update_view();\
+#define NON_MEMBER_OP2(name, str)                                                                        \
+   template <class Backend, class T>                                                                     \
+   inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend> & result, const T& a)                      \
+   {                                                                                                     \
+      using default_ops::BOOST_JOIN(eval_, name);                                                        \
+      BOOST_JOIN(eval_, name)                                                                            \
+      (result.value(), unwrap_debug_type(a));                                                            \
+      result.update_view();                                                                              \
+   }                                                                                                     \
+   template <class Backend>                                                                              \
+   inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend> & result, const debug_adaptor<Backend>& a) \
+   {                                                                                                     \
+      using default_ops::BOOST_JOIN(eval_, name);                                                        \
+      BOOST_JOIN(eval_, name)                                                                            \
+      (result.value(), unwrap_debug_type(a));                                                            \
+      result.update_view();                                                                              \
    }
 
-#define NON_MEMBER_OP3(name, str) \
-   template <class Backend, class T, class U>\
-   inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const T& a, const U& b)\
-   {\
-      using default_ops::BOOST_JOIN(eval_, name);\
-      BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b));\
-      result.update_view();\
-   }\
-   template <class Backend, class T>\
-   inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const debug_adaptor<Backend>& a, const T& b)\
-   {\
-      using default_ops::BOOST_JOIN(eval_, name);\
-      BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b));\
-      result.update_view();\
-   }\
-   template <class Backend, class T>\
-   inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const T& a, const debug_adaptor<Backend>& b)\
-   {\
-      using default_ops::BOOST_JOIN(eval_, name);\
-      BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b));\
-      result.update_view();\
-   }\
-   template <class Backend>\
-   inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const debug_adaptor<Backend>& a, const debug_adaptor<Backend>& b)\
-   {\
-      using default_ops::BOOST_JOIN(eval_, name);\
-      BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b));\
-      result.update_view();\
+#define NON_MEMBER_OP3(name, str)                                                                                                         \
+   template <class Backend, class T, class U>                                                                                             \
+   inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend> & result, const T& a, const U& b)                                           \
+   {                                                                                                                                      \
+      using default_ops::BOOST_JOIN(eval_, name);                                                                                         \
+      BOOST_JOIN(eval_, name)                                                                                                             \
+      (result.value(), unwrap_debug_type(a), unwrap_debug_type(b));                                                                       \
+      result.update_view();                                                                                                               \
+   }                                                                                                                                      \
+   template <class Backend, class T>                                                                                                      \
+   inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend> & result, const debug_adaptor<Backend>& a, const T& b)                      \
+   {                                                                                                                                      \
+      using default_ops::BOOST_JOIN(eval_, name);                                                                                         \
+      BOOST_JOIN(eval_, name)                                                                                                             \
+      (result.value(), unwrap_debug_type(a), unwrap_debug_type(b));                                                                       \
+      result.update_view();                                                                                                               \
+   }                                                                                                                                      \
+   template <class Backend, class T>                                                                                                      \
+   inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend> & result, const T& a, const debug_adaptor<Backend>& b)                      \
+   {                                                                                                                                      \
+      using default_ops::BOOST_JOIN(eval_, name);                                                                                         \
+      BOOST_JOIN(eval_, name)                                                                                                             \
+      (result.value(), unwrap_debug_type(a), unwrap_debug_type(b));                                                                       \
+      result.update_view();                                                                                                               \
+   }                                                                                                                                      \
+   template <class Backend>                                                                                                               \
+   inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend> & result, const debug_adaptor<Backend>& a, const debug_adaptor<Backend>& b) \
+   {                                                                                                                                      \
+      using default_ops::BOOST_JOIN(eval_, name);                                                                                         \
+      BOOST_JOIN(eval_, name)                                                                                                             \
+      (result.value(), unwrap_debug_type(a), unwrap_debug_type(b));                                                                       \
+      result.update_view();                                                                                                               \
    }
 
-#define NON_MEMBER_OP4(name, str) \
-   template <class Backend, class T, class U, class V>\
-   inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const T& a, const U& b, const V& c)\
-   {\
-      using default_ops::BOOST_JOIN(eval_, name);\
-      BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b), unwrap_debug_type(c));\
-      result.update_view();\
-   }\
-   template <class Backend, class T>\
-   inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const debug_adaptor<Backend>& a, const debug_adaptor<Backend>& b, const T& c)\
-   {\
-      using default_ops::BOOST_JOIN(eval_, name);\
-      BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b), unwrap_debug_type(c));\
-      result.update_view();\
-   }\
-   template <class Backend, class T>\
-   inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const debug_adaptor<Backend>& a, const T& b, const debug_adaptor<Backend>& c)\
-   {\
-      using default_ops::BOOST_JOIN(eval_, name);\
-      BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b), unwrap_debug_type(c));\
-      result.update_view();\
-   }\
-   template <class Backend, class T>\
-   inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const T& a, const debug_adaptor<Backend>& b, const debug_adaptor<Backend>& c)\
-   {\
-      using default_ops::BOOST_JOIN(eval_, name);\
-      BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b), unwrap_debug_type(c));\
-      result.update_view();\
-   }\
-   template <class Backend>\
-   inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const debug_adaptor<Backend>& a, const debug_adaptor<Backend>& b, const debug_adaptor<Backend>& c)\
-   {\
-      using default_ops::BOOST_JOIN(eval_, name);\
-      BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b), unwrap_debug_type(c));\
-      result.update_view();\
-   }\
-   template <class Backend, class T, class U>\
-   inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend>& result, const debug_adaptor<Backend>& a, const T& b, const U& c)\
-   {\
-      using default_ops::BOOST_JOIN(eval_, name);\
-      BOOST_JOIN(eval_, name)(result.value(), unwrap_debug_type(a), unwrap_debug_type(b), unwrap_debug_type(c));\
-      result.update_view();\
-   }\
+#define NON_MEMBER_OP4(name, str)                                                                                                                                          \
+   template <class Backend, class T, class U, class V>                                                                                                                     \
+   inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend> & result, const T& a, const U& b, const V& c)                                                                \
+   {                                                                                                                                                                       \
+      using default_ops::BOOST_JOIN(eval_, name);                                                                                                                          \
+      BOOST_JOIN(eval_, name)                                                                                                                                              \
+      (result.value(), unwrap_debug_type(a), unwrap_debug_type(b), unwrap_debug_type(c));                                                                                  \
+      result.update_view();                                                                                                                                                \
+   }                                                                                                                                                                       \
+   template <class Backend, class T>                                                                                                                                       \
+   inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend> & result, const debug_adaptor<Backend>& a, const debug_adaptor<Backend>& b, const T& c)                      \
+   {                                                                                                                                                                       \
+      using default_ops::BOOST_JOIN(eval_, name);                                                                                                                          \
+      BOOST_JOIN(eval_, name)                                                                                                                                              \
+      (result.value(), unwrap_debug_type(a), unwrap_debug_type(b), unwrap_debug_type(c));                                                                                  \
+      result.update_view();                                                                                                                                                \
+   }                                                                                                                                                                       \
+   template <class Backend, class T>                                                                                                                                       \
+   inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend> & result, const debug_adaptor<Backend>& a, const T& b, const debug_adaptor<Backend>& c)                      \
+   {                                                                                                                                                                       \
+      using default_ops::BOOST_JOIN(eval_, name);                                                                                                                          \
+      BOOST_JOIN(eval_, name)                                                                                                                                              \
+      (result.value(), unwrap_debug_type(a), unwrap_debug_type(b), unwrap_debug_type(c));                                                                                  \
+      result.update_view();                                                                                                                                                \
+   }                                                                                                                                                                       \
+   template <class Backend, class T>                                                                                                                                       \
+   inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend> & result, const T& a, const debug_adaptor<Backend>& b, const debug_adaptor<Backend>& c)                      \
+   {                                                                                                                                                                       \
+      using default_ops::BOOST_JOIN(eval_, name);                                                                                                                          \
+      BOOST_JOIN(eval_, name)                                                                                                                                              \
+      (result.value(), unwrap_debug_type(a), unwrap_debug_type(b), unwrap_debug_type(c));                                                                                  \
+      result.update_view();                                                                                                                                                \
+   }                                                                                                                                                                       \
+   template <class Backend>                                                                                                                                                \
+   inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend> & result, const debug_adaptor<Backend>& a, const debug_adaptor<Backend>& b, const debug_adaptor<Backend>& c) \
+   {                                                                                                                                                                       \
+      using default_ops::BOOST_JOIN(eval_, name);                                                                                                                          \
+      BOOST_JOIN(eval_, name)                                                                                                                                              \
+      (result.value(), unwrap_debug_type(a), unwrap_debug_type(b), unwrap_debug_type(c));                                                                                  \
+      result.update_view();                                                                                                                                                \
+   }                                                                                                                                                                       \
+   template <class Backend, class T, class U>                                                                                                                              \
+   inline void BOOST_JOIN(eval_, name)(debug_adaptor<Backend> & result, const debug_adaptor<Backend>& a, const T& b, const U& c)                                           \
+   {                                                                                                                                                                       \
+      using default_ops::BOOST_JOIN(eval_, name);                                                                                                                          \
+      BOOST_JOIN(eval_, name)                                                                                                                                              \
+      (result.value(), unwrap_debug_type(a), unwrap_debug_type(b), unwrap_debug_type(c));                                                                                  \
+      result.update_view();                                                                                                                                                \
+   }
 
 NON_MEMBER_OP2(add, "+=")
 NON_MEMBER_OP2(subtract, "-=")
@@ -346,28 +360,28 @@ inline void eval_left_shift(debug_adaptor<Backend>& arg, std::size_t a)
 {
    using default_ops::eval_left_shift;
    eval_left_shift(arg.value(), a);
-   arg.update_view();\
+   arg.update_view();
 }
 template <class Backend>
 inline void eval_left_shift(debug_adaptor<Backend>& arg, const debug_adaptor<Backend>& a, std::size_t b)
 {
    using default_ops::eval_left_shift;
    eval_left_shift(arg.value(), a.value(), b);
-   arg.update_view();\
+   arg.update_view();
 }
 template <class Backend>
 inline void eval_right_shift(debug_adaptor<Backend>& arg, std::size_t a)
 {
    using default_ops::eval_right_shift;
    eval_right_shift(arg.value(), a);
-   arg.update_view();\
+   arg.update_view();
 }
 template <class Backend>
 inline void eval_right_shift(debug_adaptor<Backend>& arg, const debug_adaptor<Backend>& a, std::size_t b)
 {
    using default_ops::eval_right_shift;
    eval_right_shift(arg.value(), a.value(), b);
-   arg.update_view();\
+   arg.update_view();
 }
 
 template <class Backend, class T>
@@ -403,26 +417,26 @@ inline void eval_bit_set(const debug_adaptor<Backend>& arg, unsigned a)
 {
    using default_ops::eval_bit_set;
    eval_bit_set(arg.value(), a);
-   arg.update_view();\
+   arg.update_view();
 }
 template <class Backend>
 inline void eval_bit_unset(const debug_adaptor<Backend>& arg, unsigned a)
 {
    using default_ops::eval_bit_unset;
    eval_bit_unset(arg.value(), a);
-   arg.update_view();\
+   arg.update_view();
 }
 template <class Backend>
 inline void eval_bit_flip(const debug_adaptor<Backend>& arg, unsigned a)
 {
    using default_ops::eval_bit_flip;
    eval_bit_flip(arg.value(), a);
-   arg.update_view();\
+   arg.update_view();
 }
 
 NON_MEMBER_OP3(gcd, "gcd")
 NON_MEMBER_OP3(lcm, "lcm")
-NON_MEMBER_OP4(powm, "powm");
+NON_MEMBER_OP4(powm, "powm")
 
 /*********************************************************************
 *
@@ -473,25 +487,27 @@ std::size_t hash_value(const debug_adaptor<Backend>& val)
 
 using backends::debug_adaptor;
 
-template<class Backend>
-struct number_category<backends::debug_adaptor<Backend> > : public number_category<Backend> {};
+template <class Backend>
+struct number_category<backends::debug_adaptor<Backend> > : public number_category<Backend>
+{};
 
 #ifdef BOOST_MSVC
 #pragma warning(pop)
 #endif
-}} // namespaces
+}} // namespace boost::multiprecision
 
-namespace std{
+namespace std {
 
 template <class Backend, boost::multiprecision::expression_template_option ExpressionTemplates>
 class numeric_limits<boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<Backend>, ExpressionTemplates> >
-   : public std::numeric_limits<boost::multiprecision::number<Backend, ExpressionTemplates> >
+    : public std::numeric_limits<boost::multiprecision::number<Backend, ExpressionTemplates> >
 {
-   typedef std::numeric_limits<boost::multiprecision::number<Backend, ExpressionTemplates> > base_type;
+   typedef std::numeric_limits<boost::multiprecision::number<Backend, ExpressionTemplates> >                           base_type;
    typedef boost::multiprecision::number<boost::multiprecision::backends::debug_adaptor<Backend>, ExpressionTemplates> number_type;
-public:
-   static number_type (min)() BOOST_NOEXCEPT { return (base_type::min)(); }
-   static number_type (max)() BOOST_NOEXCEPT { return (base_type::max)(); }
+
+ public:
+   static number_type(min)() BOOST_NOEXCEPT { return (base_type::min)(); }
+   static number_type(max)() BOOST_NOEXCEPT { return (base_type::max)(); }
    static number_type lowest() BOOST_NOEXCEPT { return -(max)(); }
    static number_type epsilon() BOOST_NOEXCEPT { return base_type::epsilon(); }
    static number_type round_error() BOOST_NOEXCEPT { return epsilon() / 2; }
@@ -503,13 +519,14 @@ public:
 
 } // namespace std
 
-namespace boost{ namespace math{
+namespace boost {
+namespace math {
 
-namespace policies{
+namespace policies {
 
 template <class Backend, boost::multiprecision::expression_template_option ExpressionTemplates, class Policy>
-struct precision< boost::multiprecision::number<boost::multiprecision::debug_adaptor<Backend>, ExpressionTemplates>, Policy>
-   : public precision<boost::multiprecision::number<Backend, ExpressionTemplates>, Policy>
+struct precision<boost::multiprecision::number<boost::multiprecision::debug_adaptor<Backend>, ExpressionTemplates>, Policy>
+    : public precision<boost::multiprecision::number<Backend, ExpressionTemplates>, Policy>
 {};
 
 #undef NON_MEMBER_OP1
@@ -517,9 +534,8 @@ struct precision< boost::multiprecision::number<boost::multiprecision::debug_ada
 #undef NON_MEMBER_OP3
 #undef NON_MEMBER_OP4
 
-} // namespace policies
-
-}} // namespaces boost::math
+}
 
+}} // namespace boost::math::policies
 
 #endif