std::chrono:: operator/ (calendar)
|
Definiert in Header
<chrono>
|
||
year_month
|
||
|
constexpr
auto
operator
/
(
const
std::
chrono
::
year
&
y,
const
std::
chrono
::
month
&
m
)
noexcept
|
(1) | (seit C++20) |
|
constexpr
auto
operator
/
(
const
std::
chrono
::
year
&
y,
int
m
)
noexcept
- > std:: chrono :: year_month ; |
(2) | (seit C++20) |
month_day
|
||
|
constexpr
auto
operator
/
(
const
std::
chrono
::
month
&
m,
const
std::
chrono
::
day
&
d
)
noexcept
|
(3) | (seit C++20) |
|
constexpr
auto
operator
/
(
const
std::
chrono
::
month
&
m,
int
d
)
noexcept
- > std:: chrono :: month_day ; |
(4) | (seit C++20) |
|
constexpr
auto
operator
/
(
int
m,
const
std::
chrono
::
day
&
d
)
noexcept
- > std:: chrono :: month_day ; |
(5) | (seit C++20) |
|
constexpr
auto
operator
/
(
const
std::
chrono
::
day
&
d,
const
std::
chrono
::
month
&
m
)
noexcept
|
(6) | (seit C++20) |
|
constexpr
auto
operator
/
(
const
std::
chrono
::
day
&
d,
int
m
)
noexcept
- > std:: chrono :: month_day ; |
(7) | (seit C++20) |
month_day_last
|
||
|
constexpr
auto
operator
/
(
const
std::
chrono
::
month
&
m,
std::
chrono
::
last_spec
)
noexcept
|
(8) | (seit C++20) |
|
constexpr
auto
operator
/
(
int
m,
std::
chrono
::
last_spec
)
noexcept
- > std:: chrono :: month_day_last ; |
(9) | (seit C++20) |
|
constexpr
auto
operator
/
(
std::
chrono
::
last_spec
,
const
std::
chrono
::
month
&
m
)
noexcept
|
(10) | (seit C++20) |
|
constexpr
auto
operator
/
(
std::
chrono
::
last_spec
,
int
m
)
noexcept
- > std:: chrono :: month_day_last ; |
(11) | (seit C++20) |
month_weekday
|
||
|
constexpr
auto
operator
/
(
const
std::
chrono
::
month
&
m,
const
std::
chrono
::
weekday_indexed
&
wdi
)
noexcept
|
(12) | (seit C++20) |
|
constexpr
auto
operator
/
(
int
m,
const
std::
chrono
::
weekday_indexed
&
wdi
)
noexcept
- > std:: chrono :: month_weekday ; |
(13) | (seit C++20) |
|
constexpr
auto
operator
/
(
const
std::
chrono
::
weekday_indexed
&
wdi,
const
std::
chrono
::
month
&
m
)
noexcept
|
(14) | (seit C++20) |
|
constexpr
auto
operator
/
(
const
std::
chrono
::
weekday_indexed
&
wdi,
int
m
)
noexcept
- > std:: chrono :: month_weekday ; |
(15) | (seit C++20) |
month_weekday_last
|
||
|
constexpr
auto
operator
/
(
const
std::
chrono
::
month
&
m,
const
std::
chrono
::
weekday_last
&
wdl
)
noexcept
|
(16) | (seit C++20) |
|
constexpr
auto
operator
/
(
int
m,
const
std::
chrono
::
weekday_last
&
wdl
)
noexcept
- > std:: chrono :: month_weekday_last ; |
(17) | (seit C++20) |
|
constexpr
auto
operator
/
(
const
std::
chrono
::
weekday_last
&
wdl,
const
std::
chrono
::
month
&
m
)
noexcept
|
(18) | (seit C++20) |
|
constexpr
auto
operator
/
(
const
std::
chrono
::
weekday_last
&
wdl,
int
m
)
noexcept
- > std:: chrono :: month_weekday_last ; |
(19) | (seit C++20) |
year_month_day
|
||
|
constexpr
auto
operator
/
(
const
std::
chrono
::
year_month
&
ym,
const
std::
chrono
::
day
&
d
)
noexcept
|
(20) | (seit C++20) |
|
constexpr
auto
operator
/
(
const
std::
chrono
::
year_month
&
ym,
int
d
)
noexcept
- > std:: chrono :: year_month_day ; |
(21) | (seit C++20) |
|
constexpr
auto
operator
/
(
const
std::
chrono
::
year
&
y,
const
std::
chrono
::
month_day
&
md
)
noexcept
|
(22) | (seit C++20) |
|
constexpr
auto
operator
/
(
int
y,
const
std::
chrono
::
month_day
&
md
)
noexcept
- > std:: chrono :: year_month_day ; |
(23) | (seit C++20) |
|
constexpr
auto
operator
/
(
const
std::
chrono
::
month_day
&
md,
const
std::
chrono
::
year
&
y
)
noexcept
|
(24) | (seit C++20) |
|
constexpr
auto
operator
/
(
const
std::
chrono
::
month_day
&
md,
int
y
)
noexcept
- > std:: chrono :: year_month_day ; |
(25) | (seit C++20) |
year_month_day_last
|
||
|
constexpr
auto
operator
/
(
const
std::
chrono
::
year_month
&
ym,
std::
chrono
::
last_spec
)
noexcept
|
(26) | (seit C++20) |
|
constexpr
auto
operator
/
(
const
std::
chrono
::
year
&
y,
const
std::
chrono
::
month_day_last
&
mdl
)
noexcept
|
(27) | (seit C++20) |
|
constexpr
auto
operator
/
(
int
y,
const
std::
chrono
::
month_day_last
&
mdl
)
noexcept
- > std:: chrono :: year_month_day_last ; |
(28) | (seit C++20) |
|
constexpr
auto
operator
/
(
const
std::
chrono
::
month_day_last
&
mdl,
const
std::
chrono
::
year
&
y
)
noexcept
|
(29) | (seit C++20) |
|
constexpr
auto
operator
/
(
const
std::
chrono
::
month_day_last
&
mdl,
int
y
)
noexcept
- > std:: chrono :: year_month_day_last ; |
(30) | (seit C++20) |
year_month_weekday
|
||
|
constexpr
auto
operator
/
(
const
std::
chrono
::
year_month
&
ym,
const
std::
chrono
::
weekday_indexed
&
wdi
)
noexcept
|
(31) | (seit C++20) |
|
constexpr
auto
operator
/
(
const
std::
chrono
::
year
&
y,
const
std::
chrono
::
month_weekday
&
mwd
)
noexcept
|
(32) | (seit C++20) |
|
constexpr
auto
operator
/
(
int
y,
const
std::
chrono
::
month_weekday
&
mwd
)
noexcept
- > std:: chrono :: year_month_weekday ; |
(33) | (seit C++20) |
|
constexpr
auto
operator
/
(
const
std::
chrono
::
month_weekday
&
mwd,
const
std::
chrono
::
year
&
y
)
noexcept
|
(34) | (seit C++20) |
|
constexpr
auto
operator
/
(
const
std::
chrono
::
month_weekday
&
mwd,
int
y
)
noexcept
- > std:: chrono :: year_month_weekday ; |
(35) | (seit C++20) |
year_month_weekday_last
|
||
|
constexpr
auto
operator
/
(
const
std::
chrono
::
year_month
&
ym,
const
std::
chrono
::
weekday_last
&
wdl
)
noexcept
|
(36) | (seit C++20) |
|
constexpr
auto
operator
/
(
const
std::
chrono
::
year
&
y,
const
std::
chrono
::
month_weekday_last
&
mwdl
)
noexcept
|
(37) | (seit C++20) |
|
constexpr
auto
operator
/
(
int
y,
const
std::
chrono
::
month_weekday_last
&
mwdl
)
noexcept
- > std:: chrono :: year_month_weekday_last ; |
(38) | (seit C++20) |
|
constexpr
auto
operator
/
(
const
std::
chrono
::
month_weekday_last
&
mwdl,
const
std::
chrono
::
year
&
y
)
noexcept
|
(39) | (seit C++20) |
|
constexpr
auto
operator
/
(
const
std::
chrono
::
month_weekday_last
&
mwdl,
int
y
)
noexcept
- > std:: chrono :: year_month_weekday_last ; |
(40) | (seit C++20) |
Diese operator / Überladungen bieten eine konventionelle Syntax für die Erstellung von Proleptic Gregorian calendar Datumsangaben.
Für die Erstellung eines vollständigen Datums wird eine der folgenden drei Reihenfolgen akzeptiert:
-
year/month/day, -
month/day/year, -
day/month/year.
In jedem Fall kann
day
ersetzt werden durch eines von:
- std::chrono::last , für den letzten Tag des Monats;
-
weekday [ i ], für deniten weekday des Monats; -
weekday [ std::chrono::last ], für den letzten weekday des Monats.
Eine einfache Ganzzahl wird akzeptiert, wenn ihre Bedeutung aus den Typen der anderen Operanden eindeutig hervorgeht: 2005y / 4 / 5 ist erlaubt, aber 5 / April / 2005 ist nicht erlaubt.
Partielle Datumstypen (
year_month
,
month_day
, etc.) können erstellt werden, indem der zweite
operator
/
in keiner der drei Reihenfolgen angewendet wird.
Rückgabewert
Beispiel
#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))); // Diese 3 Jahr/Monat/Tag-Reihenfolgen, die tatsächlich auf diesem Planeten und darüber hinaus verwendet werden: 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() {}