Created on 2003-12-16.00:00:00 last changed 172 months ago
Proposed resolution:
Insert a new paragraph between [iterator.requirements]/7+8:
[..] The result of the application of functions in the library to invalid ranges is undefined.
The result of directly or indirectly evaluating any comparison function or the binary - operator with two iterator values as arguments that were obtained from two different ranges r1 and r2 (including their past-the-end values) which are not subranges of one common range is undefined, unless explicitly described otherwise.
Rationale:
Solved by N3066.
[ 2010 Pittsburgh: Moved to NAD Editorial. Rationale added below. ]
[ 2009-10 Santa Cruz: ]
Leave as Open. Alisdair has volunteered to refine the wording.
[ 2009-09-20 Daniel provided wording. ]
[ 2009-07 Frankfurt ]
Daniel volunteered to work on this.
[ Sydney: The intention is that comparing two iterators from different containers is undefined, but it's not clear if we say that, or even whether it's something we should be saying in clause 23 or in clause 24. Intuitively we might want to say that equality is defined only if one iterator is reachable from another, but figuring out how to say it in any sensible way is a bit tricky: reachability is defined in terms of equality, so we can't also define equality in terms of reachability. ]
What requirements does the standard place on equality comparisons between iterators that refer to elements of different containers. For example, if v1 and v2 are empty vectors, is v1.end() == v2.end() allowed to yield true? Is it allowed to throw an exception?
The standard appears to be silent on both questions.
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-10-21 18:28:33 | admin | set | messages: + msg2666 |
2010-10-21 18:28:33 | admin | set | messages: + msg2665 |
2010-10-21 18:28:33 | admin | set | messages: + msg2664 |
2010-10-21 18:28:33 | admin | set | messages: + msg2663 |
2010-10-21 18:28:33 | admin | set | messages: + msg2662 |
2010-10-21 18:28:33 | admin | set | messages: + msg2661 |
2010-10-21 18:28:33 | admin | set | messages: + msg2660 |
2003-12-16 00:00:00 | admin | create |