This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Immediate status.
s - i wellSection: 26.2 [algorithms.requirements] Status: Immediate Submitter: Jonathan Wakely Opened: 2025-11-07 Last modified: 2025-11-07
Priority: Not Prioritized
View other active issues in [algorithms.requirements].
View all other issues in [algorithms.requirements].
View all issues with Immediate status.
Discussion:
Addresses US 154-252
“the semantics of s - i has” is not grammatically correct.
Additionally, “type, value, and value category” are properties of expressions,
not “semantics”.
[Kona 2025-11-07; approved by LWG. Status changed: New → Immediate.]
Proposed resolution:
This wording is relative to N5014.
Modify 26.2 [algorithms.requirements], as indicated:
-11- In the description of the algorithms, operator
+is used for some of the iterator categories for which it does not have to be defined. In these cases the semantics ofa + nare the same as those ofauto tmp = a; for (; n < 0; ++n) --tmp; for (; n > 0; --n) ++tmp; return tmp;Similarly, operator-is used for some combinations of iterators and sentinel types for which it does not have to be defined. If [a,b) denotes a range, the semantics ofb - ain these cases are the same as those ofiter_difference_t<decltype(a)> n = 0; for (auto tmp = a; tmp != b; ++tmp) ++n; return n;and if [b,a) denotes a range, the same as those ofiter_difference_t<decltype(b)> n = 0; for (auto tmp = b; tmp != a; ++tmp) --n; return n;For each iterator
iand sentinelsproduced from a ranger, the semantics ofs - iare the same as those of an expression that has the same type, value, and value category asranges::distance(i, s).[Note 3: The implementation can use
ranges::distance(r)when that produces the same value asranges::distance(i, s). This can be more efficient for sized ranges. — end note]