Skip to content

Latest commit

 

History

History
71 lines (55 loc) · 1.98 KB

File metadata and controls

71 lines (55 loc) · 1.98 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 weekday_indexed& wdi); // (1) C++20
}

概要

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

戻り値

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

  • (1) : 以下と等価:
    auto i = wdi.index();
    return os << (i >= 1 && i <= 5 ?
      format(os.getloc(), STATICALLY-WIDEN<charT>("{:L}[{}]"), wdi.weekday(), i) :
      format(os.getloc(), STATICALLY-WIDEN<charT>("{:L}[{} is not a valid index]"),
             wdi.weekday(), i));
    • wdi.index()[link index.md]
    • format[link /reference/chrono/format.md]
    • wdi.weekday()[link weekday.md]
    • os.getloc()[link /reference/ios/ios_base/getloc.md]

#include <iostream>
#include <chrono>

namespace chrono = std::chrono;

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

出力

Sun[1]

バージョン

言語

  • C++20

処理系

関連項目

参照