• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

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

    履歴 編集

    function
    <chrono>

    std::chrono::year_month_day_last::ok

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

    概要

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

    戻り値

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

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

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

    出力

    バージョン

    言語

    • C++20

    処理系