最終更新日時(UTC):
が更新

履歴 編集

function
<chrono>

std::chrono::operator/(C++20)

namespace std::chrono {
  constexpr month_day
    operator/(const day& d, const month& m) noexcept; // (1) C++20
  constexpr month_day
    operator/(const day& d, int m) noexcept;          // (2) C++20

}

概要

カレンダー要素同士をつなぎ合わせる。

  • (1) : day型とmonth型をつなぎ、月と日の両方の情報をもつ型にまとめる
  • (2) : day型とint型での月の値をつなぎ、月と日の両方の情報をもつ型にまとめる

戻り値

  • (1) : return m / d;
  • (2) : return month{m} / d;

例外

投げない

#include <cassert>
#include <chrono>

namespace chrono = std::chrono;
using namespace std::chrono_literals;

int main()
{
  // 3月1日 (年の情報をもたない)
  chrono::month_day md1 = 1d/chrono::March;
  chrono::month_day md2 = 1d/3;
  assert(md1.month() == chrono::March);
  assert(md1.day() == 1d);
  assert(md1 == md2);
}

出力

バージョン

言語

  • C++20

処理系

  • Clang: 8.0
  • GCC: (9.2時点で実装なし)
  • Visual C++: (2019 Update 3時点で実装なし)