std::chrono::year_month_day_last:: year, std::chrono::year_month_day_last:: month, std::chrono::year_month_day_last:: day, std::chrono::year_month_day_last:: month_day_last
From cppreference.net
<
cpp
|
chrono
|
year month day last
C++
Date and time library
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::chrono::year_month_day_last
| Member functions | ||||
|
year_month_day_last::year
year_month_day_last::month
year_month_day_last::day
year_month_day_last::month_day_last
|
||||
| Nonmember functions | ||||
| Helper classes | ||||
|
constexpr
std::
chrono
::
year
year
(
)
const
noexcept
;
|
(1) | (自 C++20 起) |
|
constexpr
std::
chrono
::
month
month
(
)
const
noexcept
;
|
(2) | (自 C++20 起) |
|
constexpr
std::
chrono
::
day
day
(
)
const
noexcept
;
|
(3) | (自 C++20 起) |
|
constexpr
std::
chrono
::
month_day_last
month_day_last
(
)
const
noexcept
;
|
(4) | (自 C++20 起) |
获取存储在此
year_month_day_last
对象中的字段值。
返回值
1)
返回存储的
std::chrono::year
值。
2)
返回存储的
std::chrono::month
值。
3)
一个与存储的年和月的最后一天对应的
std::chrono::day
值。如果
this
-
>
ok
(
)
为
false
,则返回值未指定。
4)
由
month()
构造的
std::chrono::month_day_last
。
示例
运行此代码
#include <chrono> int main() { constexpr auto ymdl{std::chrono::last/11/2020}; static_assert ( ymdl.day() == std::chrono::day(30) && ymdl.month() == std::chrono::November && ymdl.year() == std::chrono::year(2020) && ymdl.month_day_last() == std::chrono::November/std::chrono::last ); }