diff --git a/include/date/date.h b/include/date/date.h index 00b29930..22de94dd 100644 --- a/include/date/date.h +++ b/include/date/date.h @@ -418,8 +418,8 @@ class year CONSTCD11 explicit operator int() const NOEXCEPT; CONSTCD11 bool ok() const NOEXCEPT; - static CONSTCD11 year min() NOEXCEPT { return year{-32767}; } - static CONSTCD11 year max() NOEXCEPT { return year{32767}; } + static CONSTCD11 year (min)() NOEXCEPT { return year{-32767}; } + static CONSTCD11 year (max)() NOEXCEPT { return year{32767}; } }; CONSTCD11 bool operator==(const year& x, const year& y) NOEXCEPT; @@ -1167,7 +1167,7 @@ struct no_overflow static const std::intmax_t n2 = R2::num / gcd_n1_n2; static const std::intmax_t d2 = R2::den / gcd_d1_d2; #ifdef __cpp_constexpr - static const std::intmax_t max = std::numeric_limits::max(); + static const std::intmax_t max = (std::numeric_limits::max)(); #else static const std::intmax_t max = LLONG_MAX; #endif @@ -1631,7 +1631,7 @@ inline bool year::ok() const NOEXCEPT { - return y_ != std::numeric_limits::min(); + return y_ != (std::numeric_limits::min)(); } CONSTCD11 @@ -6107,7 +6107,7 @@ read_signed(std::basic_istream& is, unsigned m = 1, unsigned M = { if (c == '-' || c == '+') (void)is.get(); - auto x = static_cast(read_unsigned(is, std::max(m, 1u), M)); + auto x = static_cast(read_unsigned(is, (std::max)(m, 1u), M)); if (!is.fail()) { if (c == '-') @@ -6328,20 +6328,20 @@ from_stream(std::basic_istream& is, const CharT* fmt, auto modified = CharT{}; auto width = -1; - CONSTDATA int not_a_year = numeric_limits::min(); + CONSTDATA int not_a_year = (numeric_limits::min)(); CONSTDATA int not_a_2digit_year = 100; CONSTDATA int not_a_century = not_a_year / 100; CONSTDATA int not_a_month = 0; CONSTDATA int not_a_day = 0; - CONSTDATA int not_a_hour = numeric_limits::min(); + CONSTDATA int not_a_hour = (numeric_limits::min)(); CONSTDATA int not_a_hour_12_value = 0; CONSTDATA int not_a_minute = not_a_hour; - CONSTDATA Duration not_a_second = Duration::min(); + CONSTDATA Duration not_a_second = (Duration::min)(); CONSTDATA int not_a_doy = -1; CONSTDATA int not_a_weekday = 8; CONSTDATA int not_a_week_num = 100; CONSTDATA int not_a_ampm = -1; - CONSTDATA minutes not_a_offset = minutes::min(); + CONSTDATA minutes not_a_offset = (minutes::min)(); int Y = not_a_year; // c, F, Y * int y = not_a_2digit_year; // D, x, y * @@ -7446,7 +7446,7 @@ from_stream(std::basic_istream& is, const CharT* fmt, goto broken; G = tG; } - if (Y < static_cast(year::min()) || Y > static_cast(year::max())) + if (Y < static_cast((year::min)()) || Y > static_cast((year::max)())) Y = not_a_year; bool computed = false; if (G != not_a_year && V != not_a_week_num && wd != not_a_weekday) diff --git a/include/date/islamic.h b/include/date/islamic.h index 82ed6597..4f768b7a 100644 --- a/include/date/islamic.h +++ b/include/date/islamic.h @@ -258,8 +258,8 @@ class year CONSTCD11 explicit operator int() const NOEXCEPT; CONSTCD11 bool ok() const NOEXCEPT; - static CONSTCD11 year min() NOEXCEPT; - static CONSTCD11 year max() NOEXCEPT; + static CONSTCD11 year (min)() NOEXCEPT; + static CONSTCD11 year (max)() NOEXCEPT; }; CONSTCD11 bool operator==(const year& x, const year& y) NOEXCEPT; @@ -1079,17 +1079,17 @@ CONSTCD11 inline bool year::ok() const NOEXCEPT {return true;} CONSTCD11 inline year -year::min() NOEXCEPT +(year::min)() NOEXCEPT { - return year{std::numeric_limits::min()}; + return year{(std::numeric_limits::min)()}; } CONSTCD11 inline year -year::max() NOEXCEPT +(year::max)() NOEXCEPT { - return year{std::numeric_limits::max()}; + return year{(std::numeric_limits::max)()}; } CONSTCD11 diff --git a/include/date/iso_week.h b/include/date/iso_week.h index 4a0a4a9b..cb6b1578 100644 --- a/include/date/iso_week.h +++ b/include/date/iso_week.h @@ -151,8 +151,8 @@ class year CONSTCD11 explicit operator int() const NOEXCEPT; CONSTCD11 bool ok() const NOEXCEPT; - static CONSTCD11 year min() NOEXCEPT; - static CONSTCD11 year max() NOEXCEPT; + static CONSTCD11 year (min)() NOEXCEPT; + static CONSTCD11 year (max)() NOEXCEPT; }; CONSTCD11 bool operator==(const year& x, const year& y) NOEXCEPT; @@ -600,12 +600,12 @@ inline year& year::operator+=(const years& y) NOEXCEPT {*this = *this + y; retur inline year& year::operator-=(const years& y) NOEXCEPT {*this = *this - y; return *this;} CONSTCD11 inline year::operator int() const NOEXCEPT {return y_;} -CONSTCD11 inline bool year::ok() const NOEXCEPT {return min() <= *this && *this <= max();} +CONSTCD11 inline bool year::ok() const NOEXCEPT {return (min)() <= *this && *this <= (max)();} CONSTCD11 inline year -year::min() NOEXCEPT +(year::min)() NOEXCEPT { using std::chrono::seconds; using std::chrono::minutes; @@ -614,14 +614,14 @@ year::min() NOEXCEPT static_assert(sizeof(seconds)*CHAR_BIT >= 41, "seconds may overflow"); static_assert(sizeof(hours)*CHAR_BIT >= 30, "hours may overflow"); return sizeof(minutes)*CHAR_BIT < 34 ? - year{1970} + duration_cast(minutes::min()) : - year{std::numeric_limits::min()}; + year{1970} + duration_cast((minutes::min)()) : + year{(std::numeric_limits::min)()}; } CONSTCD11 inline year -year::max() NOEXCEPT +(year::max)() NOEXCEPT { using std::chrono::seconds; using std::chrono::minutes; @@ -631,7 +631,7 @@ year::max() NOEXCEPT static_assert(sizeof(hours)*CHAR_BIT >= 30, "hours may overflow"); return sizeof(minutes)*CHAR_BIT < 34 ? year{1969} + duration_cast(minutes::max()) : - year{std::numeric_limits::max()}; + year{(std::numeric_limits::max)()}; } CONSTCD11 diff --git a/include/date/julian.h b/include/date/julian.h index d909d69b..b40ff566 100644 --- a/include/date/julian.h +++ b/include/date/julian.h @@ -258,8 +258,8 @@ class year CONSTCD11 explicit operator int() const NOEXCEPT; CONSTCD11 bool ok() const NOEXCEPT; - static CONSTCD11 year min() NOEXCEPT; - static CONSTCD11 year max() NOEXCEPT; + static CONSTCD11 year (min)() NOEXCEPT; + static CONSTCD11 year (max)() NOEXCEPT; }; CONSTCD11 bool operator==(const year& x, const year& y) NOEXCEPT; @@ -1073,17 +1073,17 @@ CONSTCD11 inline bool year::ok() const NOEXCEPT {return true;} CONSTCD11 inline year -year::min() NOEXCEPT +(year::min)() NOEXCEPT { - return year{std::numeric_limits::min()}; + return year{(std::numeric_limits::min)()}; } CONSTCD11 inline year -year::max() NOEXCEPT +(year::max)() NOEXCEPT { - return year{std::numeric_limits::max()}; + return year{(std::numeric_limits::max)()}; } CONSTCD11 diff --git a/include/date/ptz.h b/include/date/ptz.h index dc8f0cf7..cb3990bc 100644 --- a/include/date/ptz.h +++ b/include/date/ptz.h @@ -355,8 +355,8 @@ time_zone::get_info(date::sys_time st) const } else // constant offset { - r.begin = sys_days{year::min()/January/1}; - r.end = sys_days{year::max()/December/last}; + r.begin = sys_days{(year::min)()/January/1}; + r.end = sys_days{(year::max)()/December/last}; r.abbrev = std_abbrev_; } return r; @@ -445,8 +445,8 @@ time_zone::get_info(date::local_time tp) const } else // constant offset { - r.first.begin = sys_days{year::min()/January/1}; - r.first.end = sys_days{year::max()/December/last}; + r.first.begin = sys_days{(year::min)()/January/1}; + r.first.end = sys_days{(year::max)()/December/last}; r.first.abbrev = std_abbrev_; r.first.offset = offset_; } diff --git a/include/date/solar_hijri.h b/include/date/solar_hijri.h index 6f6c331b..66aa5b52 100644 --- a/include/date/solar_hijri.h +++ b/include/date/solar_hijri.h @@ -280,8 +280,8 @@ class year CONSTCD11 explicit operator int() const NOEXCEPT; CONSTCD11 bool ok() const NOEXCEPT; - static CONSTCD11 year min() NOEXCEPT; - static CONSTCD11 year max() NOEXCEPT; + static CONSTCD11 year (min)() NOEXCEPT; + static CONSTCD11 year (max)() NOEXCEPT; }; CONSTCD11 bool operator==(const year& x, const year& y) NOEXCEPT; @@ -1104,17 +1104,17 @@ CONSTCD11 inline bool year::ok() const NOEXCEPT {return true;} CONSTCD11 inline year -year::min() NOEXCEPT +(year::min)() NOEXCEPT { - return year{std::numeric_limits::min()}; + return year{(std::numeric_limits::min)()}; } CONSTCD11 inline year -year::max() NOEXCEPT +(year::max)() NOEXCEPT { - return year{std::numeric_limits::max()}; + return year{(std::numeric_limits::max)()}; } CONSTCD11 diff --git a/include/date/tz_private.h b/include/date/tz_private.h index aec01d04..01c486e6 100644 --- a/include/date/tz_private.h +++ b/include/date/tz_private.h @@ -247,8 +247,8 @@ struct zonelet local_seconds until_loc_; std::chrono::minutes initial_save_{0}; std::string initial_abbrev_; - std::pair first_rule_{nullptr, date::year::min()}; - std::pair last_rule_{nullptr, date::year::max()}; + std::pair first_rule_{nullptr, (date::year::min)()}; + std::pair last_rule_{nullptr, (date::year::max)()}; ~zonelet(); zonelet(); diff --git a/src/tz.cpp b/src/tz.cpp index 87b14dfc..2f643cc9 100644 --- a/src/tz.cpp +++ b/src/tz.cpp @@ -36,9 +36,6 @@ // more than we need and do it early so windows.h doesn't get included // without these macros having been defined. // min/max macros interfere with the C++ versions. -# ifndef NOMINMAX -# define NOMINMAX -# endif // We don't need all that Windows has to offer. # ifndef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN @@ -329,8 +326,8 @@ get_download_gz_file(const std::string& version) #endif // !USE_OS_TZDB // These can be used to reduce the range of the database to save memory -CONSTDATA auto min_year = date::year::min(); -CONSTDATA auto max_year = date::year::max(); +CONSTDATA auto min_year = (date::year::min)(); +CONSTDATA auto max_year = (date::year::max)(); CONSTDATA auto min_day = date::January/1; CONSTDATA auto max_day = date::December/31; @@ -1112,7 +1109,7 @@ detail::Rule::Rule(const std::string& s) in >> word; if (word == "min") { - starting_year_ = year::min(); + starting_year_ = (year::min)(); } else throw std::runtime_error("Didn't find expected word: " + word); @@ -1562,7 +1559,7 @@ find_rule_for_zone(const std::pair& eqr, auto r = eqr.first; auto ry = r->starting_year(); auto prev_save = minutes{0}; - auto prev_year = year::min(); + auto prev_year = (year::min)(); const Rule* prev_rule = nullptr; while (r != nullptr) { @@ -1588,7 +1585,7 @@ find_rule_for_zone(const std::pair& eqr, auto r = eqr.first; auto ry = r->starting_year(); auto prev_save = minutes{0}; - auto prev_year = year::min(); + auto prev_year = (year::min)(); const Rule* prev_rule = nullptr; while (r != nullptr) { @@ -1627,7 +1624,7 @@ find_rule(const std::pair& first_rule, using namespace date; auto r = first_rule.first; auto ry = first_rule.second; - sys_info x{sys_days(year::min()/min_day), sys_days(year::max()/max_day), + sys_info x{sys_days((year::min)()/min_day), sys_days((year::max)()/max_day), seconds{0}, initial_save, initial_abbrev}; while (r != nullptr) { @@ -2137,7 +2134,7 @@ time_zone::load_sys_info(std::vector::const_iterator i) cons } else { - r.begin = sys_days(year::min()/min_day); + r.begin = sys_days((year::min)()/min_day); r.end = i+1 != transitions_.end() ? i[1].timepoint : sys_seconds(sys_days(year::max()/max_day)); r.offset = i[0].info->offset; @@ -2419,8 +2416,8 @@ time_zone::adjust_infos(const std::vector& rules) } else { - z.first_rule_ = std::make_pair(nullptr, year::min()); - z.last_rule_ = std::make_pair(nullptr, year::max()); + z.first_rule_ = std::make_pair(nullptr, (year::min)()); + z.last_rule_ = std::make_pair(nullptr, (year::max)()); } } } @@ -2434,9 +2431,9 @@ time_zone::adjust_infos(const std::vector& rules) #ifndef NDEBUG if (z.first_rule_.first == nullptr) { - assert(z.first_rule_.second == year::min()); + assert(z.first_rule_.second == (year::min)()); assert(z.last_rule_.first == nullptr); - assert(z.last_rule_.second == year::max()); + assert(z.last_rule_.second == (year::max)()); } else { @@ -2539,7 +2536,7 @@ time_zone::get_info_impl(sys_seconds tp, int tz_int) const if (i != zonelets_.begin()) r.begin = i[-1].until_utc_; else - r.begin = sys_days(year::min()/min_day); + r.begin = sys_days((year::min)()/min_day); r.end = i->until_utc_; r.offset = i->gmtoff_ + i->u.save_; r.save = i->u.save_; @@ -2549,7 +2546,7 @@ time_zone::get_info_impl(sys_seconds tp, int tz_int) const if (i != zonelets_.begin()) r.begin = i[-1].until_utc_; else - r.begin = sys_days(year::min()/min_day); + r.begin = sys_days((year::min)()/min_day); r.end = i->until_utc_; r.offset = i->gmtoff_; }