• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

    最終更新日時(UTC):
    が更新

    履歴 編集

    function
    <chrono>

    std::chrono::year_month_weekday_last::ok

    constexpr bool ok() const noexcept; // (1) C++20
    

    概要

    year_month_weekday_lastオブジェクトの値が有効な日付の範囲内かを判定する。

    戻り値

    以下の全ての条件を満たす場合にこの関数はtrueを返し、そうでなければfalseを返す:

    • year()メンバ関数によって返されるオブジェクトyok()true
    • month()メンバ関数によって返されるオブジェクトmok()true
    • weekday_last()メンバ関数によって返されるオブジェクトwdlok()true

    #include <cassert>
    #include <chrono>
    
    namespace chrono = std::chrono;
    using namespace std::chrono_literals;
    
    int main()
    {
      assert((2020y/3/chrono::Sunday[chrono::last]).ok() == true);
    }
    

    出力

    バージョン

    言語

    • C++20

    処理系