A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/language/../error/error_code/../../chrono/operator_slash.html below:

std::chrono::operator/(calendar) - cppreference.com

year_month

(1) (since C++20) (2) (since C++20)

month_day

(3) (since C++20) (4) (since C++20) (5) (since C++20) (6) (since C++20) (7) (since C++20)

month_day_last

(8) (since C++20) (9) (since C++20) (10) (since C++20) (11) (since C++20)

month_weekday

(12) (since C++20) (13) (since C++20) (14) (since C++20) (15) (since C++20)

month_weekday_last

(16) (since C++20) (17) (since C++20) (18) (since C++20) (19) (since C++20)

year_month_day

(20) (since C++20) (21) (since C++20) (22) (since C++20) (23) (since C++20) (24) (since C++20) (25) (since C++20)

year_month_day_last

(26) (since C++20) (27) (since C++20) (28) (since C++20) (29) (since C++20) (30) (since C++20)

year_month_weekday

(31) (since C++20) (32) (since C++20) (33) (since C++20) (34) (since C++20) (35) (since C++20)

year_month_weekday_last

(36) (since C++20) (37) (since C++20) (38) (since C++20) (39) (since C++20) (40) (since C++20)

These operator/ overloads provide a conventional syntax for the creation of Proleptic Gregorian calendar dates.

For creation of a full date, any of the following three orders are accepted:

In each case day can replaced with one of:

A plain integer is accepted if its meaning is unambiguous from the types of other operands: 2005y/4/5 is allowed, but 5/April/2005 is not.

Partial-date types (year_month, month_day, etc.) can be created by not applying the second operator/ in any of the three orders.

[edit] Return value [edit] Example
#include <chrono>
using namespace std::chrono;
 
constexpr auto ym{2021y/8};
static_assert(ym == year_month(year(2021), August));
 
constexpr auto md{9/15d};
static_assert(md == month_day(September, day(15)));
 
constexpr auto mdl{October/last};
static_assert(mdl == month_day_last(month(10)));
 
constexpr auto mw{11/Monday[3]};
static_assert(mw == month_weekday(November, Monday[3]));
 
constexpr auto mwdl{December/Sunday[last]};
static_assert(mwdl == month_weekday_last(month(12), weekday_last(Sunday)));
 
// Those 3 year/month/day orders that people actually use on this planet and beyond:
constexpr auto ymd{year(2021)/January/day(23)};
static_assert(ymd == month{1}/23/2021);
static_assert(ymd == day{23}/1/2021);
static_assert(ymd == year_month_day(2021y, month(January), 23d));
 
int main() {}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4