std::chrono...th_day_last)(3)

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

πŸ’– NAME

okay bestie, welcome to the std::chrono...th_day_last)(3) page from the C++ Standard Libary manual β€” yes, that’s the manual name, folded in near the top like a lil bookmark instead of copying the header line. The name is std::chrono::operator==,(std::chrono::month_day_last) β€” dash β€” std::chrono::operator==,(std::chrono::month_day_last). That comma after == is literally part of the listed name, so we’re keeping it. Periodt. πŸ’…

✨ Synopsis

First things first: the manual says Defined in header <chrono>. πŸ¦‹ Lowkey iconic. Here are the overloads, with the literal code bits kept exactly as given:

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

Overload (1) is the == one, since C++20. Overload (2) is the <=> one, also since C++20. Both are noexcept, bestie β€” no cap. πŸ‘‘

So what does it do? It compares the two month_day_last values x and y β€” that’s the whole vibe. The <, <=, >, >=, and != operators are synthesized from operator<=> and operator== respectively. Cute, efficient, very main character energy. ✨

πŸŽ€ Return value

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

🌸 Example

Run this code, fr fr:

// Run this code

#include <chrono>
#include <iostream>

int main()
{
    constexpr auto mdl1{std::chrono::February/std::chrono::last};
    constexpr std::chrono::month_day_last mdl2{std::chrono::month(2)};
    std::cout << std::boolalpha << (mdl1 == mdl2) << '\n';

    static_assert(mdl1 <= mdl2);
}

⭐ Output

true

That’s the whole page, bestie! Big shoutout to http://cppreference.com, version/date 2024.06.10, and the page tag std::chrono...th_day_last)(3) β€” mwah πŸ’‹πŸŽ€

πŸ“¦ where this page comes from