std::chrono...year_month)(3)

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

πŸ’– NAME πŸ’–

okay so this manual page is for std::chrono::operator<<(std::chrono::year_month) β€” and yes, that is the whole iconic name, no cap. It's hanging out in the C++ Standard Library section of the manual, and it's literally the stream-output operator for std::chrono::year_month. It's giving "let's make this chrono type printable" energy. πŸ’…βœ¨


✨ Synopsis ✨

Defined in header <chrono>.

template< class CharT, class Traits >

std::basic_ostream<CharT, Traits>&
operator<<( std::basic_ostream<CharT, Traits>& os,
            const std::chrono::year_month& ym );

(since C++20)

It outputs a textual representation of ym into the stream os, as if by:

os << std::format(os.getloc(), STATICALLY_WIDEN<CharT>("{}/{:L}"), ym.year(),
                  ym.month())

where STATICALLY_WIDEN<CharT>("{}/{:L}") is "{}/{:L}" if CharT is char, and L"{}/{:L}" if CharT is wchar_t. πŸŽ€


🫢 Return value 🫢

It returns os. That's it, that's the return value bestie β€” os is right there, living its main character life. 😌


🌈 Example 🌈

This section is incomplete.

Reason: no example

Like... no example, bestie. We are not inventing one, we are respecting the manual's unfinished era. πŸ’€


πŸ”₯ Defect reports πŸ”₯

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

  • DR: 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 yeah, P2372R3 came through and said "actually, L is needed to use the given locale." Periodt. πŸ’…


πŸ¦‹ See also πŸ¦‹

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

Obsessed with the formatting support, honestly. ✨


πŸŽ€ Category πŸŽ€

  • Todo no example

mwah πŸ’‹ β€” this cutie came from http://cppreference.com, version/date 2024.06.10. Slay and goodbye, bestie! πŸŒΈπŸ¦‹

πŸ“¦ where this page comes from