constexpr std::chrono::weekday operator+(const std::chrono::weekday& wd, const std::chrono::days& d) noexcept; | (1) | (since C++20) |
constexpr std::chrono::weekday operator+(const std::chrono::days& d, const std::chrono::weekday& wd) noexcept; | (2) | (since C++20) |
constexpr std::chrono::weekday operator-(const std::chrono::weekday& wd, const std::chrono::days& d) noexcept; | (3) | (since C++20) |
constexpr std::chrono::days operator-(const std::chrono::weekday& wd1, const std::chrono::weekday& wd2) noexcept; | (4) | (since C++20) |
d.count()
days to wd
. The weekday value held in the result is computed by first evaluating static_cast<long long>(unsigned(wd)) + d.count()
and reducing it modulo 7 to an integer in the range [0, 6].d.count()
days from wd
. Equivalent to return wd + -d;
wd1.ok()
and wd2.ok()
are both true
, returns a std::chrono::days
value d
such that d.count()
is in the range [0, 6] and wd2 + d == wd1
. Otherwise the returned value is unspecified.std::chrono::weekday
holding a weekday value calculated as described above.std::chrono::days
representing the distance between wd1
and wd2
.As long as the computation doesn't overflow, (1-3) always return a valid weekday
even if wd.ok()
is false
.
increments or decrements the weekday (public member function) |
|
adds or subtracts a number of days (public member function) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/chrono/weekday/operator_arith_2