Defined in header <chrono> | ||
---|---|---|
constexpr std::chrono::year_month_day operator+(const std::chrono::year_month_day& ymd, const std::chrono::months& dm) noexcept; | (since C++20) | |
constexpr std::chrono::year_month_day operator+(const std::chrono::months& dm, const std::chrono::year_month_day& ymd) noexcept; | (since C++20) | |
constexpr std::chrono::year_month_day operator+(const std::chrono::year_month_day& ymd, const std::chrono::years& dy) noexcept; | (since C++20) | |
constexpr std::chrono::year_month_day operator+(const std::chrono::years& dy, const std::chrono::year_month_day& ymd) noexcept; | (since C++20) | |
constexpr std::chrono::year_month_day operator-(const std::chrono::year_month_day& ymd, const std::chrono::months& dm) noexcept; | (since C++20) | |
constexpr std::chrono::year_month_day operator-(const std::chrono::year_month_day& ymd, const std::chrono::years& dy) noexcept; | (since C++20) |
dm.count()
months to the date represented by ymd
. The result has the same day()
as ymd
and the same year()
and month()
as std::chrono::year_month(ymd.year(), ymd.month()) + dm
.dy.count()
years to the date represented by ymd
. The result is equivalent to std::chrono::year_month_day(ymd.year() + dy, ymd.month(), ymd.day()
.dm.count()
months from the date represented by ymd
. Equivalent to ymd + -dm
.dy.count()
years from the date represented by ymd
. Equivalent to ymd + -dy
.Even if ymd.ok()
is true, the resulting year_month_day
may not represent a valid date if ymd.day()
is 29, 30, or 31.
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/chrono/year_month_day/operator_arith_2