std::chrono::operator<<(std::chrono::year_month_day)
From cppreference.com
< cpp | chrono | year month day
| ヘッダー <chrono> で定義 |
||
| template< class CharT, class Traits > std::basic_ostream<CharT, Traits>& |
(C++20以降) | |
ストリーム os に ymd のテキスト表現を出力します。まず、yyyy-mm-dd の形式(formatter が %F 指定子で出力するものと同じ)で日付のテキスト表現からなる std::basic_string<CharT> s を形成します。次に、!ymd.ok() の場合、s に " is not a valid date" を追加します。s を os に挿入します。
以下と等価です。
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>("...") は、CharT が char の場合は "..."、CharT が wchar_t の場合は L"..." です。
[編集] 戻り値
os
[編集] 例
| このセクションは未完成です 理由: 例がありません |
[編集] 関連項目
| (C++20) |
引数のフォーマット済み表現を新しい文字列に格納する (関数テンプレート) |
year_month_day の書式設定サポート(クラス テンプレートの特殊化) |