std::chrono::year_month_day::ok
From cppreference.com
< cpplrm; | chronolrm; | year month day
constexpr bool ok() const noexcept; |
(since C++20) | |
Checks if this year_month_day
object represents a valid calendar date.
Return value
true if this year_month_day
object represents a valid calendar date, that is, the stored year, month, and day values are all valid and the stored day value is within the number of days in the given year and month. Otherwise false.
Possible implementation
constexpr bool std::chrono::year_month_day::ok() const noexcept { return year().ok() && month().ok() && day().ok() && day() <= (year()/month()/std::chrono::last).day(); } |