Title
UK-265: RandomAccessIterator's operator- has nonsensical effects clause
Status
c++11
Section
[random.access.iterators]
Submitter
Doug Gregor

Created on 2009-03-20.00:00:00 last changed 161 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Modify Table 105 in [random.access.iterators]:

Table 105 — Random access iterator requirements (in addition to bidirectional iterator)
Expression Return type Operational semantics Assertion/note
pre-/post-condition
b - a Distance distance(a,b) return n pre: there exists a value n of Distance such that a + n == b. b == a + (b - a).
Date: 2010-10-21.18:28:33

[ 2010 Pittsburgh: ]

Moved to Ready for Pittsburgh.

Date: 2010-02-13.00:00:00

[ 2010-02-13 Daniel updates the wording to address the circularity problem. ]

The previous wording is preserved here:

Modify [random.access.iterators]p7-9 as follows:

difference_type operator-(const X& a, const X& b);

-7- Precondition: there exists a value n of difference_type such that a == b + n.

-8- Effects: b == a + (b - a)

-9- Returns: (a < b) ? distance(a,b) : -distance(b,a)n

Date: 2010-02-13.00:00:00

[ 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.

Date: 2010-10-21.18:28:33

[ 2009-10 Santa Cruz: ]

Moved to Ready.

Date: 2009-09-18.00:00:00

[ 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
Date: 2009-03-20.00:00:00

Addresses UK 265

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

History
Date User Action Args
2011-08-23 20:07:26adminsetstatus: wp -> c++11
2010-10-21 18:28:33adminsetmessages: + msg623
2010-10-21 18:28:33adminsetmessages: + msg622
2010-10-21 18:28:33adminsetmessages: + msg621
2010-10-21 18:28:33adminsetmessages: + msg620
2010-10-21 18:28:33adminsetmessages: + msg619
2010-10-21 18:28:33adminsetmessages: + msg618
2009-03-20 00:00:00admincreate