std::chrono::month_weekday::ok
Von cppreference.com
< cpp | chrono | month weekday
| constexpr bool ok() const noexcept; |
(seit C++20) | |
Prüft, ob die enthaltenen month und weekday_indexed Objekte gültig sind.
[bearbeiten] Rückgabewert
month().ok() && weekday_indexed().ok()
[bearbeiten] Beispiel
Führen Sie diesen Code aus
#include <cassert> #include <chrono> int main() { auto mwdi{std::chrono::March/std::chrono::Friday[1]}; assert(mwdi.ok()); mwdi = {std::chrono::month(17)/std::chrono::Friday[1]}; assert(not mwdi.ok()); mwdi = {std::chrono::March/std::chrono::Friday[-4]}; assert(not mwdi.ok()); }