|
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | ||||
month::ok | ||||
| Nonmember functions | ||||
| Helper classes | ||||
(C++26) |
constexprbool ok()constnoexcept; | (since C++20) | |
Checks if the month value stored in*this is in the valid range, i.e.,[1, 12].
true if the month value stored in*this is in the range[1, 12]. Otherwisefalse.
#include <chrono>#include <iostream> int main(){for(constunsigned mm:{6u, 0u, 16U}){std::cout<< mm<<": ";conststd::chrono::month m{mm}; m.ok()?std::cout<<"month is valid\n":std::cout<<"month is invalid\n";}}
Output:
6: month is valid0: month is invalid16: month is invalid