std::chrono::year_month_weekday:: ok
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | ||||
|
year_month_weekday::ok
|
||||
| Nonmember functions | ||||
| Helper classes | ||||
|
constexpr
bool
ok
(
)
const
noexcept
;
|
(seit C++20) | |
Prüft, ob dieses
year_month_weekday
Objekt ein gültiges Datum repräsentiert.
Rückgabewert
true
wenn dieses
year_month_weekday
Objekt ein gültiges Datum repräsentiert, das heißt,
year
(
)
.
ok
(
)
&&
month
(
)
.
ok
(
)
&&
weekday_indexed
(
)
.
ok
(
)
ist
true
und es mindestens
index()
weekday()
s
im angegebenen Jahr und Monat gibt. Andernfalls
false
.
Beispiel
#include <cassert> #include <chrono> int main() { auto ymwdi{std::chrono::Wednesday[1]/1/2021}; assert(ymwdi.ok()); ymwdi = std::chrono::year(2021)/std::chrono::month(1)/std::chrono::Wednesday[42]; assert(!ymwdi.ok()); }