fix user defined literals for compatibility with msvc 18

This commit is contained in:
Andre Nguyen 2020-08-20 21:58:31 -04:00 committed by Howard Hinnant
parent 1ec2ea0295
commit 7990eae740
2 changed files with 28 additions and 14 deletions

View File

@ -1655,9 +1655,12 @@ inline
bool
month_day::ok() const NOEXCEPT
{
CONSTDATA julian::day d[] =
{31_d, 29_d, 31_d, 30_d, 31_d, 30_d, 31_d, 31_d, 30_d, 31_d, 30_d, 31_d};
return m_.ok() && 1_d <= d_ && d_ <= d[static_cast<unsigned>(m_)-1];
CONSTDATA julian::day d[] = {
julian::day(31), julian::day(29), julian::day(31), julian::day(30),
julian::day(31), julian::day(30), julian::day(31), julian::day(31),
julian::day(30), julian::day(31), julian::day(30), julian::day(31)
};
return m_.ok() && julian::day(1) <= d_ && d_ <= d[static_cast<unsigned>(m_)-1];
}
CONSTCD11
@ -1946,9 +1949,12 @@ inline
day
year_month_day_last::day() const NOEXCEPT
{
CONSTDATA julian::day d[] =
{31_d, 28_d, 31_d, 30_d, 31_d, 30_d, 31_d, 31_d, 30_d, 31_d, 30_d, 31_d};
return month() != feb || !y_.is_leap() ? d[static_cast<unsigned>(month())-1] : 29_d;
CONSTDATA julian::day d[] = {
julian::day(31), julian::day(28), julian::day(31), julian::day(30),
julian::day(31), julian::day(30), julian::day(31), julian::day(31),
julian::day(30), julian::day(31), julian::day(30), julian::day(31)
};
return month() != feb || !y_.is_leap() ? d[static_cast<unsigned>(month())-1] : julian::day(29);
}
CONSTCD14
@ -2190,7 +2196,7 @@ year_month_day::ok() const NOEXCEPT
{
if (!(y_.ok() && m_.ok()))
return false;
return 1_d <= d_ && d_ <= (y_/m_/last).day();
return julian::day(1) <= d_ && d_ <= (y_/m_/last).day();
}
CONSTCD11

View File

@ -1707,9 +1707,13 @@ inline
bool
month_day::ok() const NOEXCEPT
{
CONSTDATA solar_hijri::day d[] =
{31_d, 31_d, 31_d, 31_d, 31_d, 31_d, 30_d, 30_d, 30_d, 30_d, 30_d, 30_d};
return m_.ok() && 1_d <= d_ && d_ <= d[static_cast<unsigned>(m_)-1];
CONSTDATA solar_hijri::day d[] = {
solar_hijri::day(31), solar_hijri::day(31), solar_hijri::day(31),
solar_hijri::day(31), solar_hijri::day(31), solar_hijri::day(31),
solar_hijri::day(30), solar_hijri::day(30), solar_hijri::day(30),
solar_hijri::day(30), solar_hijri::day(30), solar_hijri::day(30)
};
return m_.ok() && solar_hijri::day(1) <= d_ && d_ <= d[static_cast<unsigned>(m_)-1];
}
CONSTCD11
@ -1998,10 +2002,14 @@ inline
day
year_month_day_last::day() const NOEXCEPT
{
CONSTDATA solar_hijri::day d[] =
{31_d, 31_d, 31_d, 31_d, 31_d, 31_d, 30_d, 30_d, 30_d, 30_d, 30_d, 29_d};
CONSTDATA solar_hijri::day d[] = {
solar_hijri::day(31), solar_hijri::day(31), solar_hijri::day(31),
solar_hijri::day(31), solar_hijri::day(31), solar_hijri::day(31),
solar_hijri::day(30), solar_hijri::day(30), solar_hijri::day(30),
solar_hijri::day(30), solar_hijri::day(30), solar_hijri::day(29)
};
return month() != esf || !y_.is_leap() ?
d[static_cast<unsigned>(month())-1] : 30_d;
d[static_cast<unsigned>(month()) - 1] : solar_hijri::day(30);
}
CONSTCD14
@ -2260,7 +2268,7 @@ year_month_day::ok() const NOEXCEPT
{
if (!(y_.ok() && m_.ok()))
return false;
return 1_d <= d_ && d_ <= (y_/m_/last).day();
return solar_hijri::day(1) <= d_ && d_ <= (y_/m_/last).day();
}
CONSTCD11