std::chrono...day_indexed)(3)

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

πŸ’– std::chrono...day_indexed)(3) πŸ’–

okay so bestie, welcome to the std::chrono...day_indexed)(3) page from the C++ Standard Libary manual. yes, we're doing chrono operator hours, and it's giving tiny-but-iconic. πŸ’…

✨ NAME ✨

  • std::chrono::operator==(std::chrono::weekday_indexed) β€” the name on the tin.
  • std::chrono::operator==(std::chrono::weekday_indexed) β€” and the original page literally says it again, so here it is again, no cap. 😭

πŸ¦‹ Synopsis πŸ¦‹

Defined in header <chrono> ✨

constexpr bool operator==( const std::chrono::weekday_indexed& x,
                           const std::chrono::weekday_indexed& y )

This one is (since C++20) and it's noexcept; β€” periodt.

It compares the two weekday_indexed values x and y. The != operator is synthesized from operator==. iykyk ✨

πŸ’– Return value πŸ’–

This is the whole answer, no cap:

x.weekday() == y.weekday() && x.index() == y.index()

πŸŽ€ Example πŸŽ€

// Run this code

        #include <chrono>

        int main()
        {
            constexpr std::chrono::weekday_indexed
       wdi1{std::chrono::Wednesday[2]};
            constexpr std::chrono::weekday_indexed
       wdi2{std::chrono::weekday(3), 2};
            static_assert(wdi1 == wdi2);
        }

That static_assert ate, fr fr. 🫢


xoxo bestie πŸ’‹ source is http://cppreference.com, dated 2024.06.10, and the footer tag is std::chrono...day_indexed)(3). bye! πŸ¦‹

πŸ“¦ where this page comes from