名前空間
変種
操作

std::chrono::operator<<(std::chrono::year_month_day)

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

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

                const std::chrono::year_month_day& ymd );
(C++20以降)

ストリーム osymd のテキスト表現を出力します。まず、yyyy-mm-dd の形式(formatter が %F 指定子で出力するものと同じ)で日付のテキスト表現からなる std::basic_string<CharT> s を形成します。次に、!ymd.ok() の場合、s" is not a valid date" を追加します。sos に挿入します。

以下と等価です。

return os << (ymd.ok() ?
    std::format(STATICALLY_WIDEN<CharT>("{:%F}"), ymd) :
    std::format(STATICALLY_WIDEN<CharT>("{:%F} is not a valid date"), ymd));

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

[編集] 戻り値

os

[編集]

[編集] 関連項目

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