mirror of
https://github.com/HowardHinnant/date.git
synced 2024-12-27 16:41:04 +08:00
fix user defined literals for compatibility with msvc 18
This commit is contained in:
parent
1ec2ea0295
commit
7990eae740
@ -1655,9 +1655,12 @@ inline
|
|||||||
bool
|
bool
|
||||||
month_day::ok() const NOEXCEPT
|
month_day::ok() const NOEXCEPT
|
||||||
{
|
{
|
||||||
CONSTDATA julian::day d[] =
|
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};
|
julian::day(31), julian::day(29), julian::day(31), julian::day(30),
|
||||||
return m_.ok() && 1_d <= d_ && d_ <= d[static_cast<unsigned>(m_)-1];
|
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
|
CONSTCD11
|
||||||
@ -1946,9 +1949,12 @@ inline
|
|||||||
day
|
day
|
||||||
year_month_day_last::day() const NOEXCEPT
|
year_month_day_last::day() const NOEXCEPT
|
||||||
{
|
{
|
||||||
CONSTDATA julian::day d[] =
|
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};
|
julian::day(31), julian::day(28), julian::day(31), julian::day(30),
|
||||||
return month() != feb || !y_.is_leap() ? d[static_cast<unsigned>(month())-1] : 29_d;
|
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
|
CONSTCD14
|
||||||
@ -2190,7 +2196,7 @@ year_month_day::ok() const NOEXCEPT
|
|||||||
{
|
{
|
||||||
if (!(y_.ok() && m_.ok()))
|
if (!(y_.ok() && m_.ok()))
|
||||||
return false;
|
return false;
|
||||||
return 1_d <= d_ && d_ <= (y_/m_/last).day();
|
return julian::day(1) <= d_ && d_ <= (y_/m_/last).day();
|
||||||
}
|
}
|
||||||
|
|
||||||
CONSTCD11
|
CONSTCD11
|
||||||
|
@ -1707,9 +1707,13 @@ inline
|
|||||||
bool
|
bool
|
||||||
month_day::ok() const NOEXCEPT
|
month_day::ok() const NOEXCEPT
|
||||||
{
|
{
|
||||||
CONSTDATA solar_hijri::day d[] =
|
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};
|
solar_hijri::day(31), solar_hijri::day(31), solar_hijri::day(31),
|
||||||
return m_.ok() && 1_d <= d_ && d_ <= d[static_cast<unsigned>(m_)-1];
|
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
|
CONSTCD11
|
||||||
@ -1998,10 +2002,14 @@ inline
|
|||||||
day
|
day
|
||||||
year_month_day_last::day() const NOEXCEPT
|
year_month_day_last::day() const NOEXCEPT
|
||||||
{
|
{
|
||||||
CONSTDATA solar_hijri::day d[] =
|
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};
|
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() ?
|
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
|
CONSTCD14
|
||||||
@ -2260,7 +2268,7 @@ year_month_day::ok() const NOEXCEPT
|
|||||||
{
|
{
|
||||||
if (!(y_.ok() && m_.ok()))
|
if (!(y_.ok() && m_.ok()))
|
||||||
return false;
|
return false;
|
||||||
return 1_d <= d_ && d_ <= (y_/m_/last).day();
|
return solar_hijri::day(1) <= d_ && d_ <= (y_/m_/last).day();
|
||||||
}
|
}
|
||||||
|
|
||||||
CONSTCD11
|
CONSTCD11
|
||||||
|
Loading…
x
Reference in New Issue
Block a user