std::chrono::month:: ok
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | ||||
|
month::ok
|
||||
| Nonmember functions | ||||
| Helper classes | ||||
|
(C++26)
|
|
constexpr
bool
ok
(
)
const
noexcept
;
|
(seit C++20) | |
Überprüft, ob der in
*
this
gespeicherte Monatswert im gültigen Bereich liegt, d.h.
[
1
,
12
]
.
Rückgabewert
true
wenn der in
*
this
gespeicherte Monatswert im Bereich
[
1
,
12
]
liegt. Andernfalls
false
.
Beispiel
#include <chrono> #include <iostream> int main() { for (const unsigned mm : {6u, 0u, 16U}) { std::cout << mm << ": "; const std::chrono::month m{mm}; m.ok() ? std::cout << "month is valid\n" : std::cout << "month is invalid\n"; } }
Ausgabe:
6: month is valid 0: month is invalid 16: month is invalid