Skip to content

Latest commit

 

History

History
66 lines (52 loc) · 1.75 KB

File metadata and controls

66 lines (52 loc) · 1.75 KB

operator/

  • chrono[meta header]
  • std::chrono[meta namespace]
  • function[meta id-type]
  • cpp20[meta cpp]
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
}
  • month[link /reference/chrono/month.md]
  • month_day_last[link /reference/chrono/month_day_last.md]

概要

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

  • (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);
}
  • chrono::February[link /reference/chrono/month_constants.md]
  • chrono::month_day_last[link /reference/chrono/month_day_last.md]
  • mdl1.month()[link /reference/chrono/month_day_last/month.md]

出力

バージョン

言語

  • C++20

処理系

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