std::chrono::weekday_indexed:: ok
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | ||||
|
weekday_indexed::ok
|
||||
| Nonmember functions | ||||
| Helper classes | ||||
|
constexpr
bool
ok
(
)
const
noexcept
;
|
(seit C++20) | |
Überprüft, ob das Wochentag-Objekt und der in * this gespeicherte Index beide gültig sind.
Rückgabewert
true
wenn
weekday
(
)
.
ok
(
)
==
true
und
index()
im Bereich
[
1
,
5
]
liegt. Andernfalls
false
.
Beispiel
#include <chrono> #include <iostream> int main() { std::cout << std::boolalpha; std::chrono::weekday_indexed wdi{std::chrono::Tuesday[2]}; std::cout << (wdi.ok()) << ' '; wdi = {std::chrono::weekday(42)[2]}; std::cout << (wdi.ok()) << ' '; wdi = {std::chrono::Tuesday[-4]}; std::cout << (wdi.ok()) << '\n'; }
Ausgabe:
true false false