diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2019-12-05 15:12:59 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2019-12-05 15:12:59 +0900 |
commit | b8cf34c691623e4ec329053cbbf68522a855882d (patch) | |
tree | 34da08632a99677f6b79ecb65e5b655a5b69a67f /boost/date_time/int_adapter.hpp | |
parent | 3fdc3e5ee96dca5b11d1694975a65200787eab86 (diff) | |
download | boost-b8cf34c691623e4ec329053cbbf68522a855882d.tar.gz boost-b8cf34c691623e4ec329053cbbf68522a855882d.tar.bz2 boost-b8cf34c691623e4ec329053cbbf68522a855882d.zip |
Imported Upstream version 1.67.0upstream/1.67.0
Diffstat (limited to 'boost/date_time/int_adapter.hpp')
-rw-r--r-- | boost/date_time/int_adapter.hpp | 41 |
1 files changed, 14 insertions, 27 deletions
diff --git a/boost/date_time/int_adapter.hpp b/boost/date_time/int_adapter.hpp index 39210864ca..6ee7712fab 100644 --- a/boost/date_time/int_adapter.hpp +++ b/boost/date_time/int_adapter.hpp @@ -18,6 +18,12 @@ # include <ostream> #endif +#if defined(BOOST_MSVC) +#pragma warning(push) +// conditional expression is constant +#pragma warning(disable: 4127) +#endif + namespace boost { namespace date_time { @@ -136,9 +142,7 @@ public: } bool operator==(const int& rhs) const { - // quiets compiler warnings - bool is_signed = std::numeric_limits<int_type>::is_signed; - if(!is_signed) + if(!std::numeric_limits<int_type>::is_signed) { if(is_neg_inf(value_) && rhs == 0) { @@ -153,9 +157,7 @@ public: } bool operator!=(const int& rhs) const { - // quiets compiler warnings - bool is_signed = std::numeric_limits<int_type>::is_signed; - if(!is_signed) + if(!std::numeric_limits<int_type>::is_signed) { if(is_neg_inf(value_) && rhs == 0) { @@ -171,8 +173,7 @@ public: bool operator<(const int& rhs) const { // quiets compiler warnings - bool is_signed = std::numeric_limits<int_type>::is_signed; - if(!is_signed) + if(!std::numeric_limits<int_type>::is_signed) { if(is_neg_inf(value_) && rhs == 0) { @@ -414,18 +415,10 @@ private: //! Assumes at least 'this' or 'rhs' is a special value int_adapter mult_div_specials(const int_adapter& rhs)const { - int min_value; - // quiets compiler warnings - bool is_signed = std::numeric_limits<int_type>::is_signed; - if(is_signed) { - min_value = 0; - } - else { - min_value = 1;// there is no zero with unsigned - } if(this->is_nan() || rhs.is_nan()) { return int_adapter<int_type>(not_a_number()); } + BOOST_CONSTEXPR_OR_CONST int min_value = std::numeric_limits<int_type>::is_signed ? 0 : 1; if((*this > 0 && rhs > 0) || (*this < min_value && rhs < min_value)) { return int_adapter<int_type>(pos_infinity()); } @@ -443,18 +436,10 @@ private: //! Assumes 'this' is a special value int_adapter mult_div_specials(const int& rhs) const { - int min_value; - // quiets compiler warnings - bool is_signed = std::numeric_limits<int_type>::is_signed; - if(is_signed) { - min_value = 0; - } - else { - min_value = 1;// there is no zero with unsigned - } if(this->is_nan()) { return int_adapter<int_type>(not_a_number()); } + BOOST_CONSTEXPR_OR_CONST int min_value = std::numeric_limits<int_type>::is_signed ? 0 : 1; if((*this > 0 && rhs > 0) || (*this < min_value && rhs < 0)) { return int_adapter<int_type>(pos_infinity()); } @@ -504,6 +489,8 @@ private: } } //namespace date_time - +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif #endif |