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

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

πŸ’… std::chrono::operator<<(std::chrono::month_weekday) β€” NAME energy ✨

okay bestie, so this is the man page for std::chrono::operator<<(std::chrono::month_weekday), which is literally the same thing as std::chrono::operator<<(std::chrono::month_weekday). yes we're saying it twice, that's the NAME section's whole vibe πŸŽ€

it lives in the C++ Standard Library, manual section 3. cppreference girlies stay winning πŸ’–


🌸 Synopsis 🌸

first things first, this icon is defined in header <chrono> β€” don't forget to include it or the compiler will simply not let you have your moment 🫢

template< class CharT, class Traits >

std::basic_ostream<CharT, Traits>&                        (since
C++20)
    operator<<( std::basic_ostream<CharT, Traits>& os,

                const std::chrono::month_weekday& mwd );

since C++20 btw β€” so if you're on an older standard this is giving nothing but sadness 😭

what it actually does πŸ¦‹

it outputs a textual representation of mwd into os, as if by this exact incantation:

os << std::format(os.getloc(), STATICALLY_WIDEN<CharT>("{:L}/{:L}"),
                  mwd.month(), mwd.weekday_indexed());

and like, what even is that STATICALLY_WIDEN<CharT>("{:L}/{:L}") bestie? it's "{:L}/{:L}" if CharT is char, and L"{:L}/{:L}" if CharT is wchar_t. that's it, that's the whole mystery ✨ (wide chars said "i also deserve a slash")


πŸŽ€ Return value πŸŽ€

it returns os. that's it. it gives you back the stream. iconic minimalism, no notes πŸ‘‘


πŸ’€ Example πŸ’€

This section is incomplete Reason: no example

yeah… we got nothing. the example is a ghost πŸ‘» the void. an empty group chat. (there's even a category tag for it, see below, and it is so real of them to admit it)


πŸ”₯ Defect reports πŸ”₯

the following behavior-changing defect reports were applied retroactively to previously published C++ standards. so like, the past got a glow-up 🌈

  • P2372R3 β€” applied to C++20. Behavior as published: the given locale was used by default. Correct behavior: L is needed to use the given locale. so basically the L in {:L} is doing the heavy lifting now, no cap πŸ’…

πŸ‘‘ See also πŸ‘‘

  • format (C++20) β€” stores formatted representation of the arguments in a new string β€” function template 🧚
  • std::formatter<std::chrono::month> (C++20) β€” formatting support for month β€” class template specialization ⭐

πŸ“ Category πŸ“

  • * Todo no example β€” yes it's listed as a todo. we been knew 😭

and that's the whole page, bestie! πŸ’œ this little number comes to you courtesy of http://cppreference.com, version 2024.06.10, dated 2024.06.10, filed under std::chrono...nth_weekday)(3) β€” mwah, go format some month_weekdays, slay πŸ”₯πŸ’–

πŸ“¦ where this page comes from