std::chrono::operator<<(std::chrono::weekday_indexed)
From cppreference.com
< cpp | chrono | weekday indexed
| ヘッダー <chrono> で定義 |
||
| template< class CharT, class Traits > std::basic_ostream<CharT, Traits>& |
(C++20以降) | |
ストリーム os に、wdi のテキスト表現を出力します。これは、次のような動作と同じです。
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());
ここで STATICALLY_WIDEN<CharT>("...") は、 CharT が char の場合は "..." であり、 CharT が wchar_t の場合は L"..." です。
[編集] 戻り値
os
[編集] 不具合報告
以下の動作変更を伴う欠陥報告が、以前に公開されたC++標準に遡って適用されました。
| DR | 適用対象 | 公開された動作 | 正しい動作 |
|---|---|---|---|
| P2372R3 | C++20 | 指定されたロケールがデフォルトで使用されました | 指定されたロケールを使用するにはLが必要です |
[編集] 関連項目
| (C++20) |
引数のフォーマット済み表現を新しい文字列に格納する (関数テンプレート) |
weekday の書式設定サポート(クラス テンプレートの特殊化) |