This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.
operator-has nonsensical effects clause
Section: 27.2.7 [random.access.iterators] Status: C++11 Submitter: Doug Gregor Opened: 2009-03-20 Last modified: 2017-02-03
Priority: Not Prioritized
View all other issues in [random.access.iterators].
View all issues with C++11 status.
Addresses UK 265
This effects clause is nonesense. It looks more like an axiom stating equivalence, and certainly an effects clause cannot change the state of two arguments passed by const reference
[ 2009-09-18 Alisdair adds: ]
For random access iterators, the definitions of (b-a) and (a<b) are circular:
From table Table 104 -- Random access iterator requirements:b - a :==> (a < b) ? distance(a,b) : -distance(b,a) a < b :==> b - a > 0
[ 2009-10 Santa Cruz: ]
Moved to Ready.
[ 2010-02-13 Alisdair opens. ]
Looking again at LWG 1079, the wording in the issue no longer exists, and appears to be entirely an artefact of the concepts wording.
This issue is currently on our Ready list (not even Tentative!) but I think it has to be pulled as there is no way to apply the resolution.
Looking at the current paper, I think this issue is now "NAD, solved by the removal of concepts". Unfortunately it is too late to poll again, so we will have to perform that review in Pittsburgh.
[ 2010-02-13 Daniel updates the wording to address the circularity problem. ]
[ The previous wording is preserved here: ]
Modify 27.2.7 [random.access.iterators]p7-9 as follows:difference_type operator-(const X& a, const X& b);
-7- Precondition: there exists a value-8-
a == b + n.
b == a + (b - a)
(a < b) ? distance(a,b) : -distance(b,a)
[ 2010 Pittsburgh: ]
Moved to Ready for Pittsburgh.
Modify Table 105 in 27.2.7 [random.access.iterators]:
Table 105 — Random access iterator requirements (in addition to bidirectional iterator) Expression Return type Operational semantics Assertion/note
b - a Distance distance(a,b) pre: there exists a value n of Distance such that a + n == b. b == a + (b - a).