std::chrono...indexed::ok(3)
π NAME π
std::chrono::weekday_indexed::ok - std::chrono::weekday_indexed::ok β yep, thatβs the NAME entry, and itβs iconic π
okay so bestie, welcome to the std::chrono::weekday_indexed::ok page in the C++ Standard Libary manual β¨ this is the little function that vibe-checks whether the weekday and the index inside your std::chrono::weekday_indexed are both valid π«Ά
β¨ Synopsis β¨
constexpr bool ok() const noexcept; (since C++20)
It checks if the weekday object and the index stored in *this are both valid π no cap.
π Return value π
true if weekday().ok() == true and index() is in the range [1, 5]. Otherwise false π
π§ Example π§
// Run this code
#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';
}
π Output: π
true false false
made with love π source: http://cppreference.com Β· version/date: 2024.06.10 Β· std::chrono...indexed::ok(3) π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms