namespace std::chrono {
template <class charT, class traits>
std::basic_ostream<charT, traits>&
operator<<(std::basic_ostream<charT, traits>& os, const year_month_day& ymd); // (1) C++20
}
概要
year_month_dayオブジェクトを出力ストリームに出力する。
戻り値
便宜上のリテラルキャストSTATICALLY-WIDENを導入する。STATICALLY-WIDEN<charT>("...")は、charTがcharである場合は"..."、charTがwchar_tである場合はL"..."を意味する。
- (1) : 以下と等価:
備考
- フォーマットフラグ
"%F"は"%Y-%m-%d"と等価であり、4桁ゼロ埋め整数値の年、2桁ゼロ埋め整数値の月、2桁ゼロ埋め整数値の日が、ハイフン区切りで出力される
例
#include <iostream>
#include <chrono>
using namespace std::chrono_literals;
int main()
{
std::cout << 2020y/3/1 << std::endl;
}
出力
2020-03-01
バージョン
言語
- C++20
処理系
- Clang: 9.0 ❌
- GCC: 9.2 ❌
- Visual C++: 2019 Update 3 ❌
関連項目
- chronoの
std::format()(フォーマットの詳細)