Namespaces
Variants

std::chrono::year_month_day_last:: ok

From cppreference.net
constexpr bool ok ( ) const noexcept ;
(C++20以降)

* this が有効な日付を表すかどうかをチェックします。 year_month_day_last は特定の月の最終日を表すため、年と月が有効である限り有効な日付を表します。

戻り値

year ( ) . ok ( ) && month ( ) . ok ( )

**注記**: このC++コードは翻訳対象外のため、元のまま保持されています。コード内の`year`、`month`、`ok`等のC++識別子は意図的に翻訳していません。

#include <cassert>
#include <chrono>
int main()
{
    auto ymdl{std::chrono::last/11/2020};
    assert(ymdl.ok());
    ymdl = std::chrono::year(2020)/std::chrono::month(13)/std::chrono::last;
    assert(not ymdl.ok());
}