constexpr bool ok() const noexcept; // (1) C++20
概要
year_month_day_last
オブジェクトの値が有効な日付の範囲内かを判定する。
戻り値
以下の全ての条件を満たす場合にこの関数はtrue
を返し、そうでなければfalse
を返す:
year()
メンバ関数によって返されるオブジェクトy
のok()
がtrue
month_day_last()
メンバ関数によって返されるオブジェクトmdl
のok()
が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
処理系
- Clang: 8.0 ✅
- GCC: 11.1 ✅
- Visual C++: 2019 Update 3 ❌