std::chrono...th_weekday)(3)

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

🌸 NAME 🌸

okay so bestie, you've landed on the std::chrono::operator<<(std::chrono::year_month_weekday)(3) page from the C++ Standard Library ✨.

std::chrono::operator<<(std::chrono::year_month_weekday) β€” that's the function we're hyping up today πŸ’….


✨ Synopsis ✨

Defined in header <chrono> πŸŽ€.

(since C++20) β€” yes, this overload is a C++20 girlie, no cap.

template< class CharT, class Traits >

std::basic_ostream<CharT, Traits>&
operator<<( std::basic_ostream<CharT, Traits>& os,

            const std::chrono::year_month_weekday& ymwd );

πŸŽ€ what it actually does πŸŽ€

It outputs a textual representation of ymwd into os, as if by this exact little ritual πŸ”₯:

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

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


🌈 Return value 🌈

os β€” that's it, she returns the stream, periodt πŸ’….


πŸ’€ Defect reports πŸ’€

The following behavior-changing defect reports were applied retroactively to previously published C++ standards. yes, the lore goes back 😭.

  • 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.

πŸ¦‹ See also πŸ¦‹

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

mwah πŸ’‹ page fresh from http://cppreference.com, dated 2024.06.10 β€” xoxo, your chrono bestie 🫢

πŸ“¦ where this page comes from