std::chrono::year_month::operator+=,std::chrono::year_month::operator-= (3) - Linux Manuals
std::chrono::year_month::operator+=,std::chrono::year_month::operator-=: std::chrono::year_month::operator+=,std::chrono::year_month::operator-=
NAME
std::chrono::year_month::operator+=,std::chrono::year_month::operator-= - std::chrono::year_month::operator+=,std::chrono::year_month::operator-=
Synopsis
constexpr std::chrono::year_month& operator+=(const std::chrono::years& dy) const noexcept; (1) (since C++20)
constexpr std::chrono::year_month& operator+=(const std::chrono::months& dm) const noexcept; (2) (since C++20)
constexpr std::chrono::year_month& operator-=(const std::chrono::years& dy) const noexcept; (3) (since C++20)
constexpr std::chrono::year_month& operator-=(const std::chrono::months& dm) const noexcept; (4) (since C++20)
Modifies the time point *this represents by the duration dy or dm.
1) Equivalent to *this = *this + dy;
2) Equivalent to *this = *this + dm;
3) Equivalent to *this = *this - dy;
4) Equivalent to *this = *this - dm;
Notes
Durations that are convertible to std::chrono::months, but not std::chrono::years, can be directly added to or subtracted from a year_month. Durations convertible to std::chrono::years cannot because such durations are also convertible to std::chrono::months, resulting in an ambiguity:
See also
operator+ (function)
operator-