std::chrono...day_indexed)(3)
π NAME π
okay so this is the std::chrono...day_indexed)(3) page from the C++ Standard Libary manual β yes, the manual name is folded in right here near the top like a lil name tag π«Ά.
The actual star of the page is std::chrono::operator<<(std::chrono::weekday_indexed) β and the descriptor line is literally the same string again: std::chrono::operator<<(std::chrono::weekday_indexed). iconic, no notes π
.
πΈ Synopsis πΈ
Defined in header <chrono>:
template< class CharT, class Traits >
std::basic_ostream<CharT, Traits>& (since C++20)
operator<<( std::basic_ostream<CharT, Traits>& os,
const std::chrono::weekday_indexed& wdi );
Yep, thatβs the overload β and itβs (since C++20), so bestie, this is a newer-standard vibe β¨.
It outputs a textual representation of wdi into the stream os, as if by this exact code:
if (wdi.index() >=1 && wdi.index() <= 5)
os << std::format(os.getloc(), STATICALLY_WIDEN<CharT>("{:L}[{}]"),
wdi.weekday(), wdi.index());
else
os << std::format(os.getloc(), STATICALLY_WIDEN<CharT>("{:L}[{} is not a valid index]"),
wdi.weekday(), wdi.index());
And the little translation note is: where STATICALLY_WIDEN<CharT>("...") is "..." if CharT is char, and L"..." if CharT is wchar_t. slay, thatβs the whole magic trick π₯.
π Return value π
It returns os. Thatβs it. The stream comes back to you like a boomerang, bestie πͺ.
π¦ Defect reports π¦
okay so these behavior-changing defect reports got applied retroactively to previously published C++ standards β the committee said βactually, bestie, we need to fix thatβ π:
- DR
P2372R3β Applied to:C++20- Behavior as published: the given locale was used by default
- Correct behavior:
Lis needed to use the given locale
β See also β
format(C++20)β stores formatted representation of the arguments in a new string; itβs a function template.std::formatter<std::chrono::weekday>(C++20)β formatting support forweekday; itβs a class template specialization.
mwah π this page came from http://cppreference.com, version/date 2024.06.10, and the footer title is std::chrono...day_indexed)(3). periodt π
β¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms