Skip to content

Latest commit

 

History

History
52 lines (40 loc) · 1.45 KB

File metadata and controls

52 lines (40 loc) · 1.45 KB

ok

  • chrono[meta header]
  • std::chrono[meta namespace]
  • year_month_weekday_last[meta class]
  • function[meta id-type]
  • cpp20[meta cpp]
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);
}
  • ok()[color ff0000]
  • chrono::Sunday[link /reference/chrono/weekday_constants.md]
  • chrono::last[link /reference/chrono/last_spec.md]

出力

バージョン

言語

  • C++20

処理系

  • Clang: 8.0 [mark verified]
  • GCC: 11.1 [mark verified]
  • Visual C++: 2019 Update 3 [mark noimpl]