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

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

okay so this page is from the C++ Standard Libary manual, and the title up top is std::chrono...ay_last::ok(3) β€” yes, that exact lil truncation, iykyk πŸ’…. We're talking about a chrono function and it's honestly not that deep, bestie. Let's go. ✨

πŸŽ€ NAME πŸŽ€

std::chrono::year_month_day_last::ok β€” literally std::chrono::year_month_day_last::ok πŸ’…

✨ Synopsis ✨

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

Checks if *this represents a valid date. Because a year_month_day_last represents the last day of a particular month, it represents a valid date as long as the year and month are valid. That's it, that's the whole check, and it ate. 🫢

πŸ’– Return value πŸ’–

year().ok() && month().ok()

🌸 Example 🌸

The manual gives you a // Run this code moment, and here's the code exactly:

        #include <cassert>
        #include <chrono>

        int main()
        {
            auto ymdl{std::chrono::last/11/2020};
            assert(ymdl.ok());
            ymdl =
       std::chrono::year(2020)/std::chrono::month(13)/std::chrono::last;
            assert(not ymdl.ok());
        }

sending you a big kiss 🫢 β€” this page is from http://cppreference.com and it's dated 2024.06.10. byeeee πŸ‘‘πŸ’…

πŸ“¦ where this page comes from