std::chrono...nth_weekday)(3)

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

πŸŽ€ NAME πŸŽ€

okay bestie, this is the std::chrono...nth_weekday)(3) page from the C++ Standard Libary manual β€” manual name folded in right here β€” and the whole page is about std::chrono::operator==(std::chrono::month_weekday). The NAME section says std::chrono::operator==(std::chrono::month_weekday) - and then repeats std::chrono::operator==(std::chrono::month_weekday) like it's giving main character energy twice. πŸ’…

✨ Synopsis ✨

Defined in header <chrono>:

          constexpr bool operator==( const std::chrono::month_weekday& x,
                                     const std::chrono::month_weekday& y )
       (since C++20)
          noexcept;

so it's constexpr bool operator==(...), it's since C++20, and it's noexcept;. slay. 🫢

It compares the two month_weekday values x and y β€” that's literally the vibe check. πŸ”₯

The != operator is synthesized from operator==. no cap, it's not out here living its own separate life. 😭

πŸ’– Return value πŸ’–

It returns this exact expression, fr fr:

x.month() == y.month() && x.weekday_indexed() == y.weekday_indexed()

🌸 Example 🌸

       // Run this code

        #include <chrono>

        int main()
        {
            constexpr auto mwdi1{std::chrono::March/std::chrono::Friday[1]};

            constexpr auto mwdi2
            {
                std::chrono::month_weekday
                {
                    std::chrono::month(3), std::chrono::weekday(5)[1]
                }
            };

            static_assert(mwdi1 == mwdi2);
        }

mwah πŸ’‹ β€” source: http://cppreference.com, date/version: 2024.06.10, page: std::chrono...nth_weekday)(3). you're welcome, bestie πŸŽ€βœ¨

πŸ“¦ where this page comes from