次の方法で共有


month_weekday_last クラス

月の最後の曜日を表します。

構文

class month_weekday_last; // C++20

解説

年は指定されていません。
month_weekday_last は、普通のコピー可能な、標準レイアウト クラス型です。

メンバー

名前 説明
コンストラクター month_weekday_last を構築します
month 月の値を取得します。
ok month_weekday_last が有効かどうかを確認します。
weekday_last 曜日の値を取得します。

非メンバー

名前 説明
operator== 2 つの month_weekday_last インスタンスが等しいかどうかを判断します。
operator<< 指定のストリームに month_weekday_last を出力します。

要件

ヘッダー:<chrono> C++20 以降

名前空間std::chrono:

コンパイラ オプション:/std:c++latest

Constructor

month_weekday_lastmonth の値を使用して初期化した weekday_last を構築します。

constexpr month_weekday_last(const month& m, const weekday_last& wdl) noexcept;

パラメーター

m: 作成した month_weekday_last クラスの month 値。

wdl
作成した month_weekday_last クラスの weekday_last 値。

解説: コンストラクター

日付を指定する C++20 構文の詳細については、以下を参照してください。 operator/

例: month_weekday_last を作成する

// compile using: /std:c++latest
#include <iostream>
#include <chrono>

using namespace std::chrono;

int main()
{
    constexpr auto mwdl{ January / Monday[last] }; // wdl is the last Monday of January of an unspecified year
    std::cout << mwdl << "\n";

    const auto theMonth = August;
    const auto wdl = Friday[last];
    month_weekday_last mwdl2(theMonth, wdl); 
    std::cout << mwdl2;

    return 0;
}
Jan/Mon[last]
Aug/Fri[last]

month()

月の値を返します。

constexpr month month() const noexcept;

戻り値

月の値。

ok

この month_weekday_last に格納された値の範囲が有効であるかを確認します。

constexpr bool ok() const noexcept;

戻り値

monthweekday_last の値が有効な範囲内にある場合は true。 それ以外の場合は false

weekday_last

weekday_last 値を取得します。

constexpr weekday_last weekday_last() const noexcept;

戻り値

weekday_last の値です。

関連項目

<chrono>
month クラス
month_day クラス
month_day_last クラス
month_weekday クラス
operator/