std::chrono...ono::month)(3)

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

πŸ’– NAME πŸ’–

From the C++ Standard Libary manual (yes, that spelling is literally on the page, and I'm obsessed with the commitment πŸ’…), page std::chrono...ono::month)(3).

  • std::chrono::operator==,(std::chrono::month) β€” the std::chrono::operator==,(std::chrono::month) page. We're comparing months, bestie. That comma is canon, no cap.

✨ Synopsis ✨

Okay, synopsis time β€” exact code block, no edits:

          Defined in header <chrono>
          constexpr bool operator==( const std::chrono::month& x,
       (1) (since C++20)
                                     const std::chrono::month& y ) noexcept;
          constexpr std::strong_ordering operator<=>( const
          std::chrono::month& x,
       (2) (since C++20)
                                                      const
          std::chrono::month& y ) noexcept;

So we're comparing the two std::chrono::month values x and y. Both overloads are noexcept, and both are marked (since C++20). Pop off. πŸŽ‰

Also, the <, <=, >, >=, and != operators are synthesized from operator<=> and operator== respectively. That's the C++20 spaceship pipeline, fr fr. πŸš€

🌸 Return value 🌸

  1. unsigned(x) == unsigned(y)
  2. unsigned(x) <=> unsigned(y)

πŸŽ€ Example πŸŽ€

        // Run this code

        #include <chrono>

        int main()
        {
            constexpr std::chrono::month m1{6}, m2{8};

            static_assert
            (
                m1 < m2 && m1 == m1 && m1 <= m2 &&
                m2 > m1 && m2 != m1 && m2 >= m1 &&
                m1 <=> m2 != 0
            );
        }

Mwah πŸ’‹ this page is from http://cppreference.com, dated 2024.06.10, and it's the std::chrono...ono::month)(3) page. Byeee, go compare some months responsibly 🫢✨

πŸ“¦ where this page comes from