std::chrono::weekday_last::ok
来自cppreference.com
< cpp | chrono | weekday last
constexpr bool ok() const noexcept; |
(C++20 起) | |
检查存储于 *this 的 weekday
对象是否合法。
返回值
weekday().ok()
示例
运行此代码
#include <chrono> #include <iostream> int main() { std::cout << std::boolalpha; auto wdl{std::chrono::Tuesday[std::chrono::last]}; std::cout << (wdl.ok()) << ' '; wdl = {std::chrono::weekday(42)[std::chrono::last]}; std::cout << (wdl.ok()) << '\n'; }
输出:
true false