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

履歴 編集

function
<chrono>

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

namespace std::chrono {
  constexpr month_day_last
    operator/(last_spec, const month& m) noexcept; // (1) C++20
  constexpr month_day_last
    operator/(last_spec, int m) noexcept;          // (2) C++20
}

概要

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

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

戻り値

  • (2) : return m / last;
  • (3) : return month{m} / last;

例外

投げない

#include <cassert>
#include <chrono>

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

int main()
{
  // 2月の最終日 (年の情報をもたないため、2月かどうかに関わらず日を算出できない状態)
  chrono::month_day_last mdl1 = chrono::last/chrono::February;
  chrono::month_day_last mdl2 = chrono::last/2;
  assert(mdl1.month() == chrono::February);
  assert(mdl1 == mdl2);
}

出力

バージョン

言語

  • C++20

処理系

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