- 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++20year_month_weekday_lastオブジェクトの値が有効な日付の範囲内かを判定する。
以下の全ての条件を満たす場合にこの関数はtrueを返し、そうでなければfalseを返す:
year()メンバ関数によって返されるオブジェクトyのok()がtruemonth()メンバ関数によって返されるオブジェクトmのok()がtrueweekday_last()メンバ関数によって返されるオブジェクトwdlのok()が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]