Skip to content

Latest commit

 

History

History
69 lines (52 loc) · 1.92 KB

op_ostream.md

File metadata and controls

69 lines (52 loc) · 1.92 KB

operator<<

  • chrono[meta header]
  • std::chrono[meta namespace]
  • function[meta id-type]
  • cpp20[meta cpp]
namespace std::chrono {
  template <class charT, class traits>
  std::basic_ostream<charT, traits>&
    operator<<(std::basic_ostream<charT, traits>& os, const month_weekday& mwd); // (1) C++20
}

概要

month_weekdayオブジェクトを出力ストリームに出力する。

戻り値

便宜上のリテラルキャストSTATICALLY-WIDENを導入する。STATICALLY-WIDEN<charT>("...")は、charTcharである場合は"..."charTwchar_tである場合はL"..."を意味する。

  • (1) : 以下と等価:
    return os << format(os.getloc(), STATICALLY-WIDEN<charT>("{:L}/{:L}"), mwd.month(), mwd.weeday_indexed());
    • format[link /reference/format/format.md]
    • os.getloc()[link /reference/ios/ios_base/getloc.md]
    • mwd.month()[link month.md]
    • mwd.weekday_indexed()[link weekday_indexed.md]

#include <iostream>
#include <chrono>

namespace chrono = std::chrono;

int main()
{
  std::cout << chrono::March/chrono::Sunday[1] << std::endl;
}
  • chrono::March[link /reference/chrono/month_constants.md]
  • chrono::Sunday[link /reference/chrono/weekday_constants.md]

出力

Mar/Sun[1]

バージョン

言語

  • C++20

処理系

  • Clang: 9.0 [mark noimpl]
  • GCC: 10.1 [mark noimpl]
  • Visual C++: 2019 Update 3 [mark noimpl]

関連項目

参照