std::chrono:: operator+, std::chrono:: operator- (std::chrono::year_month_day_last)
|
Definiert in Header
<chrono>
|
||
|
constexpr
std::
chrono
::
year_month_day_last
operator
+
(
const
std::
chrono
::
year_month_day_last
&
ymdl,
|
(seit C++20) | |
|
constexpr
std::
chrono
::
year_month_day_last
operator
+
(
const
std::
chrono
::
months
&
dm,
|
(seit C++20) | |
|
constexpr
std::
chrono
::
year_month_day_last
operator
+
(
const
std::
chrono
::
year_month_day_last
&
ymdl,
|
(seit C++20) | |
|
constexpr
std::
chrono
::
year_month_day_last
operator
+
(
const
std::
chrono
::
years
&
dy,
|
(seit C++20) | |
|
constexpr
std::
chrono
::
year_month_day_last
operator
-
(
const
std::
chrono
::
year_month_day_last
&
ymdl,
|
(seit C++20) | |
|
constexpr
std::
chrono
::
year_month_day_last
operator
-
(
const
std::
chrono
::
year_month_day_last
&
ymdl,
|
(seit C++20) | |
year()
und
month()
wie
std::
chrono
::
year_month
(
ymdl.
year
(
)
, ymdl.
month
(
)
)
+
dm
.
Für Zeitdauern, die sowohl in
std::chrono::years
als auch in
std::chrono::months
konvertierbar sind, werden die
years
Überladungen
(3,4,6)
bevorzugt, falls der Aufruf andernfalls mehrdeutig wäre.
Beispiel
#include <cassert> #include <chrono> #include <iostream> int main() { auto ymdl{11/std::chrono::last/2020}; std::cout << ymdl << '\n'; ymdl = std::chrono::years(10) + ymdl; std::cout << ymdl << '\n'; assert(ymdl == std::chrono::day(30)/ std::chrono::November/ std::chrono::year(2030)); ymdl = ymdl - std::chrono::months(6); std::cout << ymdl << '\n'; assert(ymdl == std::chrono::day(31)/ std::chrono::May/ std::chrono::year(2030)); }
Ausgabe:
2020/Nov/last 2030/Nov/last 2030/May/last