std::chrono...day_last::ok(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’– NAME πŸ’–

okay bestie, this is the manual page for std::chrono::month_weekday_last::ok, from the C++ Standard Libary manual. The header is doing its abbreviated thing with std::chrono...day_last::ok, iykyk, but the full function name is the one above and the NAME line repeats it as std::chrono::month_weekday_last::ok - std::chrono::month_weekday_last::ok.

✨ Synopsis ✨

Here's the whole signature with its C++20 glow-up, copied exactly:

constexpr bool ok() const noexcept;  (since C++20)

It checks if the contained month and weekday_last objects are valid. That's literally the whole vibe check, no cap.

🫢 Return value 🫢

This returns:

month().ok() && weekday_last().ok()

So yeah β€” it's the "both of these need to pass" situation, expressed exactly like the original. πŸ’…

🌸 Example 🌸

Here's the example, kept exactly as it appears β€” including the manual's slightly chaotic line wraps, because we do not edit source code in this group chat:

       // Run this code

        #include <chrono>
        #include <iostream>

        int main()
        {
            std::cout << std::boolalpha;

            auto
       mwdl{std::chrono::March/std::chrono::Wednesday[std::chrono::last]};
            std::cout << (mwdl.ok()) << ' ';
            mwdl =
       {std::chrono::month(3)/std::chrono::weekday(42)[std::chrono::last]};
            std::cout << (mwdl.ok()) << '\n';
        }

Output:

true false

πŸ’Œ sign-off: source/version http://cppreference.com; date 2024.06.10. That's the end of the std::chrono...day_last::ok(3) page, bestie β€” periodt πŸŽ€

πŸ“¦ where this page comes from