std::chrono::year_month_weekday_last::year, std::chrono::year_month_weekday_last::month, std::chrono::year_month_weekday_last::weekday, std::chrono::year_month_weekday_last::weekday_last
constexpr std::chrono::year year() const noexcept; | (1) | (с C++20) |
constexpr std::chrono::month month() const noexcept; | (2) | (с C++20) |
constexpr std::chrono::weekday weekday() const noexcept; | (3) | (с C++20) |
constexpr std::chrono::weekday_last weekday_last() const noexcept; | (4) | (с C++20) |
Возвращает значения полей, сохранённые в этом year_month_weekday_last объекте.
Возвращаемое значение
1) Возвращает сохранённое значение
std::chrono::year.
2) Возвращает сохранённое значение
std::chrono::month.
3) Возвращает сохранённое значение
std::chrono::weekday.
4)
std::chrono::weekday_last(weekday())
Пример
#include <chrono>
#include <iostream>
using namespace std::chrono;
int main()
{
auto ymwdl{Tuesday[last]/November/2022};
auto wdl = ymwdl.weekday_last();
wdl = (wdl.weekday() + days(1))[last];
ymwdl = {ymwdl.year() + years(1), ymwdl.month() - months(2), wdl};
std::cout << year_month_day(ymwdl) << '\n';
}Вывод:
2023-09-27
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/chrono/year_month_weekday_last/accessors