]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/date_time/int_adapter.hpp
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / boost / date_time / int_adapter.hpp
index 6ee7712fab28fadb64bb4a3f560fb15fd153a63f..79a8a82949a6f22b3e75a02e69e1e056e94ab1c8 100644 (file)
@@ -46,34 +46,34 @@ template<typename int_type_>
 class int_adapter {
 public:
   typedef int_type_ int_type;
-  int_adapter(int_type v) :
+  BOOST_CXX14_CONSTEXPR int_adapter(int_type v) :
     value_(v)
   {}
-  static bool has_infinity()
+  static BOOST_CONSTEXPR bool has_infinity()
   {
     return  true;
   }
-  static const int_adapter  pos_infinity()
+  static BOOST_CONSTEXPR int_adapter  pos_infinity()
   {
     return (::std::numeric_limits<int_type>::max)();
   }
-  static const int_adapter  neg_infinity()
+  static BOOST_CONSTEXPR int_adapter  neg_infinity()
   {
     return (::std::numeric_limits<int_type>::min)();
   }
-  static const int_adapter  not_a_number()
+  static BOOST_CONSTEXPR int_adapter  not_a_number()
   {
     return (::std::numeric_limits<int_type>::max)()-1;
   }
-  static  int_adapter max BOOST_PREVENT_MACRO_SUBSTITUTION ()
+  static BOOST_CONSTEXPR int_adapter max BOOST_PREVENT_MACRO_SUBSTITUTION ()
   {
     return (::std::numeric_limits<int_type>::max)()-2;
   }
-  static  int_adapter min BOOST_PREVENT_MACRO_SUBSTITUTION ()
+  static BOOST_CONSTEXPR int_adapter min BOOST_PREVENT_MACRO_SUBSTITUTION ()
   {
     return (::std::numeric_limits<int_type>::min)()+1;
   }
-  static int_adapter from_special(special_values sv)
+  static BOOST_CXX14_CONSTEXPR int_adapter from_special(special_values sv)
   {
     switch (sv) {
     case not_a_date_time: return not_a_number();
@@ -84,25 +84,25 @@ public:
     default:              return not_a_number();
     }
   }
-  static bool is_inf(int_type v)
+  static BOOST_CONSTEXPR bool is_inf(int_type v)
   {
     return (v == neg_infinity().as_number() ||
             v == pos_infinity().as_number());
   }
-  static bool is_neg_inf(int_type v)
+  static BOOST_CXX14_CONSTEXPR bool is_neg_inf(int_type v)
   {
     return (v == neg_infinity().as_number());
   }
-  static bool is_pos_inf(int_type v)
+  static BOOST_CXX14_CONSTEXPR bool is_pos_inf(int_type v)
   {
     return (v == pos_infinity().as_number());
   }
-  static bool is_not_a_number(int_type v)
+  static BOOST_CXX14_CONSTEXPR bool is_not_a_number(int_type v)
   {
     return (v == not_a_number().as_number());
   }
   //! Returns either special value type or is_not_special
-  static special_values to_special(int_type v)
+  static BOOST_CXX14_CONSTEXPR special_values to_special(int_type v)
   {
     if (is_not_a_number(v)) return not_a_date_time;
     if (is_neg_inf(v)) return neg_infin;
@@ -111,36 +111,36 @@ public:
   }
 
   //-3 leaves room for representations of infinity and not a date
-  static  int_type maxcount()
+  static BOOST_CONSTEXPR int_type maxcount()
   {
     return (::std::numeric_limits<int_type>::max)()-3;
   }
-  bool is_infinity() const
+  BOOST_CONSTEXPR bool is_infinity() const
   {
     return (value_ == neg_infinity().as_number() ||
             value_ == pos_infinity().as_number());
   }
-  bool is_pos_infinity()const
+  BOOST_CONSTEXPR bool is_pos_infinity()const
   {
     return(value_ == pos_infinity().as_number());
   }
-  bool is_neg_infinity()const
+  BOOST_CONSTEXPR bool is_neg_infinity()const
   {
     return(value_ == neg_infinity().as_number());
   }
-  bool is_nan() const
+  BOOST_CONSTEXPR bool is_nan() const
   {
     return (value_ == not_a_number().as_number());
   }
-  bool is_special() const
+  BOOST_CONSTEXPR bool is_special() const
   {
     return(is_infinity() || is_nan()); 
   }
-  bool operator==(const int_adapter& rhs) const
+  BOOST_CONSTEXPR bool operator==(const int_adapter& rhs) const
   {
     return (compare(rhs) == 0);
   }
-  bool operator==(const int& rhs) const
+  BOOST_CXX14_CONSTEXPR bool operator==(const int& rhs) const
   {
     if(!std::numeric_limits<int_type>::is_signed)
     {
@@ -151,11 +151,11 @@ public:
     }
     return (compare(rhs) == 0);
   }
-  bool operator!=(const int_adapter& rhs) const
+  BOOST_CONSTEXPR bool operator!=(const int_adapter& rhs) const
   {
     return (compare(rhs) != 0);
   }
-  bool operator!=(const int& rhs) const
+  BOOST_CXX14_CONSTEXPR bool operator!=(const int& rhs) const
   {
     if(!std::numeric_limits<int_type>::is_signed)
     {
@@ -166,11 +166,11 @@ public:
     }
     return (compare(rhs) != 0);
   }
-  bool operator<(const int_adapter& rhs) const
+  BOOST_CONSTEXPR bool operator<(const int_adapter& rhs) const
   {
     return (compare(rhs) == -1);
   }
-  bool operator<(const int& rhs) const
+  BOOST_CXX14_CONSTEXPR bool operator<(const int& rhs) const
   {
     // quiets compiler warnings
     if(!std::numeric_limits<int_type>::is_signed)
@@ -182,16 +182,16 @@ public:
     }
     return (compare(rhs) == -1);
   }
-  bool operator>(const int_adapter& rhs) const
+  BOOST_CONSTEXPR bool operator>(const int_adapter& rhs) const
   {
     return (compare(rhs) == 1);
   }
-  int_type as_number() const
+  BOOST_CONSTEXPR int_type as_number() const
   {
     return value_;
   }
   //! Returns either special value type or is_not_special
-  special_values as_special() const
+  BOOST_CONSTEXPR special_values as_special() const
   {
     return int_adapter::to_special(value_);
   }
@@ -204,7 +204,7 @@ public:
   /*! Operator allows for adding dissimilar int_adapter types.
    * The return type will match that of the the calling object's type */
   template<class rhs_type>
-  inline
+  BOOST_CXX14_CONSTEXPR
   int_adapter operator+(const int_adapter<rhs_type>& rhs) const
   {
     if(is_special() || rhs.is_special())
@@ -234,6 +234,7 @@ public:
     return int_adapter<int_type>(value_ + static_cast<int_type>(rhs.as_number()));
   }
 
+  BOOST_CXX14_CONSTEXPR
   int_adapter operator+(const int_type rhs) const
   {
     if(is_special())
@@ -253,7 +254,7 @@ public:
   /*! Operator allows for subtracting dissimilar int_adapter types.
    * The return type will match that of the the calling object's type */
   template<class rhs_type>
-  inline
+  BOOST_CXX14_CONSTEXPR
   int_adapter operator-(const int_adapter<rhs_type>& rhs)const
   {
     if(is_special() || rhs.is_special())
@@ -282,6 +283,8 @@ public:
     }
     return int_adapter<int_type>(value_ - static_cast<int_type>(rhs.as_number()));
   }
+
+  BOOST_CXX14_CONSTEXPR
   int_adapter operator-(const int_type rhs) const
   {
     if(is_special())
@@ -299,6 +302,7 @@ public:
   }
 
   // should templatize this to be consistant with op +-
+  BOOST_CXX14_CONSTEXPR
   int_adapter operator*(const int_adapter& rhs)const
   {
     if(this->is_special() || rhs.is_special())
@@ -307,8 +311,10 @@ public:
     }
     return int_adapter<int_type>(value_ * rhs.value_);
   }
+
   /*! Provided for cases when automatic conversion from 
    * 'int' to 'int_adapter' causes incorrect results. */
+  BOOST_CXX14_CONSTEXPR
   int_adapter operator*(const int rhs) const
   {
     if(is_special())
@@ -319,6 +325,7 @@ public:
   }
 
   // should templatize this to be consistant with op +-
+  BOOST_CXX14_CONSTEXPR
   int_adapter operator/(const int_adapter& rhs)const
   {
     if(this->is_special() || rhs.is_special())
@@ -332,23 +339,27 @@ public:
         return mult_div_specials(rhs);
       }
       else { // let divide by zero blow itself up
-        return int_adapter<int_type>(value_ / rhs.value_);
+        return int_adapter<int_type>(value_ / rhs.value_); //NOLINT
       }
     }
     return int_adapter<int_type>(value_ / rhs.value_);
   }
+
   /*! Provided for cases when automatic conversion from 
    * 'int' to 'int_adapter' causes incorrect results. */
+  BOOST_CXX14_CONSTEXPR
   int_adapter operator/(const int rhs) const
   {
     if(is_special() && rhs != 0)
     {
       return mult_div_specials(rhs);
     }
-    return int_adapter<int_type>(value_ / rhs);
+    // let divide by zero blow itself up like int
+    return int_adapter<int_type>(value_ / rhs); //NOLINT
   }
 
   // should templatize this to be consistant with op +-
+  BOOST_CXX14_CONSTEXPR
   int_adapter operator%(const int_adapter& rhs)const
   {
     if(this->is_special() || rhs.is_special())
@@ -362,26 +373,31 @@ public:
         return mult_div_specials(rhs);
       }
       else { // let divide by zero blow itself up
-        return int_adapter<int_type>(value_ % rhs.value_);
+        return int_adapter<int_type>(value_ % rhs.value_); //NOLINT
       }
     }
     return int_adapter<int_type>(value_ % rhs.value_);
   }
+
   /*! Provided for cases when automatic conversion from 
    * 'int' to 'int_adapter' causes incorrect results. */
+  BOOST_CXX14_CONSTEXPR
   int_adapter operator%(const int rhs) const
   {
     if(is_special() && rhs != 0)
     {
       return mult_div_specials(rhs);
     }
-    return int_adapter<int_type>(value_ % rhs);
+    // let divide by zero blow itself up
+    return int_adapter<int_type>(value_ % rhs); //NOLINT
   }
+
 private:
   int_type value_;
   
   //! returns -1, 0, 1, or 2 if 'this' is <, ==, >, or 'nan comparison' rhs
-  int compare(const int_adapter& rhs)const
+  BOOST_CXX14_CONSTEXPR
+  int compare( const int_adapter& rhs ) const
   {
     if(this->is_special() || rhs.is_special())
     {
@@ -408,12 +424,14 @@ private:
     // implied-> if(value_ == rhs.value_) 
     return 0;
   }
+
   /* When multiplying and dividing with at least 1 special value
    * very simmilar rules apply. In those cases where the rules
    * are different, they are handled in the respective operator 
    * function. */
   //! Assumes at least 'this' or 'rhs' is a special value
-  int_adapter mult_div_specials(const int_adapter& rhs)const
+  BOOST_CXX14_CONSTEXPR
+  int_adapter mult_div_specials(const int_adapter& rhs) const
   {
     if(this->is_nan() || rhs.is_nan()) {
       return int_adapter<int_type>(not_a_number());
@@ -428,12 +446,14 @@ private:
     //implied -> if(this->value_ == 0 || rhs.value_ == 0)
     return int_adapter<int_type>(not_a_number());
   }
+
   /* Overloaded function necessary because of special
    * situation where int_adapter is instantiated with 
    * 'unsigned' and func is called with negative int.
    * It would produce incorrect results since 'unsigned'
    * wraps around when initialized with a negative value */
   //! Assumes 'this' is a special value
+  BOOST_CXX14_CONSTEXPR
   int_adapter mult_div_specials(const int& rhs) const
   {
     if(this->is_nan()) {
@@ -449,7 +469,7 @@ private:
     //implied -> if(this->value_ == 0 || rhs.value_ == 0)
     return int_adapter<int_type>(not_a_number());
   }
-  
+
 };
 
 #ifndef BOOST_DATE_TIME_NO_LOCALE