名前空間
変種
操作

std::chrono::operator<<(std::chrono::month)

From cppreference.com
< cpp‎ | chrono‎ | month
 
 
 
 
ヘッダー <chrono> で定義
template< class CharT, class Traits >

std::basic_ostream<CharT, Traits>&

    operator<<( std::basic_ostream<CharT, Traits>& os, const std::chrono::month& m );
(C++20以降)

!m.ok() の場合、unsigned(m)" is not a valid month"os に挿入します。それ以外の場合は、m が表す月(os に関連付けられたロケールを使用して決定される)の省略された月名からなる std::basic_string<CharT> s を形成し、sos に挿入します。

以下と等価です。

return os << (m.ok() ?
    std::format(os.getloc(), STATICALLY_WIDEN<CharT>("{:L%b}"), m) :
    std::format(os.getloc(), STATICALLY_WIDEN<CharT>("{} is not a valid month"), unsigned(m)));

ここで STATICALLY_WIDEN<CharT>("...") は、 CharTchar の場合は "..." であり、 CharTwchar_t の場合は L"..." です。

目次

[編集] Return value

os

[編集] Notes

この operator<< は主にデバッグ目的で使用されます。フォーマットの制御には std::format を使用してください。

[編集] Defect reports

以下の動作変更を伴う欠陥報告が、以前に公開されたC++標準に遡って適用されました。

DR 適用対象 公開された動作 正しい動作
P2372R3 C++20 指定されたロケールがデフォルトで使用されました 指定されたロケールを使用するにはLが必要です

[編集] See also

(C++20)
引数のフォーマット済み表現を新しい文字列に格納する
(関数テンプレート) [編集]
month の書式設定サポート
(クラス テンプレートの特殊化) [edit]
English 日本語 中文(简体) 中文(繁體)