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 ( )

예제

#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());
}