Created on 2023-02-09.00:00:00 last changed 12 months ago
Proposed resolution:
This wording is relative to n4928.
Modify [range.chunk.fwd.iter] p13 as indicated:
constexpr iterator& operator+=(difference_type x) requires random_access_range<Base>;-12- Preconditions: If x is positive, ranges::distance(current_, end_) > n_ * (x - 1) is true.
[Note 1: If x is negative, the Effects paragraph implies a precondition. — end note] -13- Effects: Equivalent to:if (x > 0) { ranges::advance(current_, n_ * (x - 1)); missing_ = ranges::advance(current_, n_* x, end_); } else if (x < 0) { ranges::advance(current_, n_ * x + missing_); missing_ = 0; } return *this;
Modify [range.stride.iterator] p14 as indicated:
constexpr iterator& operator+=(difference_type n) requires random_access_range<Base>;-13- Preconditions: If n is positive, ranges::distance(current_, end_) > stride_ * (n - 1) is true.
[Note 1: If n is negative, the Effects paragraph implies a precondition. — end note] -14- Effects: Equivalent to:if (n > 0) { ranges::advance(current_, stride_ * (n - 1)); missing_ = ranges::advance(current_, stride_* n, end_); } else if (n < 0) { ranges::advance(current_, stride_ * n + missing_); missing_ = 0; } return *this;
[ 2023-02-13 Approved at February 2023 meeting in Issaquah. Status changed: Immediate → WP. ]
[ Issaquah 2023-02-10; LWG issue processing ]
Move to Immediate for C++23
The intent was that the precondition allows the call to ranges::advance, which otherwise would have time linear in the argument of operator+=, to actually be implemented using operator+= or equivalent for all but the last step. This is at best very non-obvious and should be clarified.
History | |||
---|---|---|---|
Date | User | Action | Args |
2023-11-22 15:47:43 | admin | set | status: wp -> c++23 |
2023-02-13 11:31:32 | admin | set | messages: + msg13405 |
2023-02-13 11:31:32 | admin | set | status: immediate -> wp |
2023-02-10 18:26:23 | admin | set | messages: + msg13341 |
2023-02-10 18:26:23 | admin | set | status: new -> immediate |
2023-02-10 15:46:58 | admin | set | messages: + msg13334 |
2023-02-09 00:00:00 | admin | create |