名前空間
変種
操作

std::chrono::weekday_last::weekday

From cppreference.com
< cpp‎ | chrono‎ | weekday last
 
 
 
 
constexpr std::chrono::weekday weekday() const noexcept;
(C++20以降)

std::chrono::weekday オブジェクトのコピーを取得します。これは *this に格納されています。

[編集] 戻り値

std::chrono::weekday オブジェクトのコピー。これは *this に格納されています。

[編集]

#include <chrono>
#include <iostream>
using namespace std::chrono;
 
int main()
{
    std::cout << std::boolalpha;
 
    auto wdl{Tuesday[last]}; // Last Tuesday of a month
    std::cout << (year_month_day{wdl/10/2019} ==
                  year_month_day{October/29/2019}) << ' ';
 
    wdl = {(wdl.weekday() + days(2))[last]}; // Last Tuesday is now last Thursday
    std::cout << (year_month_day{wdl/10/2019} ==
                  year_month_day{October/31/2019}) << '\n';
}

出力

true true
English 日本語 中文(简体) 中文(繁體)