namespace std::chrono {
constexpr year_month_weekday
operator/(const month_weekday& mwd, const year& y) noexcept; // (1) C++20
constexpr year_month_weekday
operator/(const month_weekday& mwd, int y) noexcept; // (2) C++20
}
概要
カレンダー要素同士をつなぎ合わせる。
- (1) :
month_weekday
型とyear
型をつなぎ、年月の指定したN回目の曜日の情報をもつ型にまとめる - (2) :
month_weekday
型とint
型での年の値をつなぎ、年月の指定したN回目の曜日の情報をもつ型にまとめる
戻り値
- (1) :
return y / mwd;
- (2) :
return year{y} / mwd;
例外
投げない
例
#include <cassert>
#include <chrono>
using namespace std::chrono;
int main()
{
assert((March/Sunday[1])/2020y == (year_month_weekday{2020y, March, Sunday[1]}));
assert((March/Sunday[1])/2020 == (year_month_weekday{2020y, March, Sunday[1]}));
}
xxxxxxxxxx
#include <cassert>
#include <chrono>
using namespace std::chrono;
int main()
{
assert((March/Sunday[1])/2020y == (year_month_weekday{2020y, March, Sunday[1]}));
assert((March/Sunday[1])/2020 == (year_month_weekday{2020y, March, Sunday[1]}));
}
出力
バージョン
言語
- C++20
処理系
- Clang: 8.0 ✅
- GCC: 11.1 ✅
- Visual C++: 2019 Update 3 ❌