Title
24.1.5 contains unintended limitation for operator-
Status
nad
Section
[random.access.iterators]
Submitter
Daniel Frey

Created on 2004-02-27.00:00:00 last changed 172 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

To remove this limitation, I suggest to change the operational semantics for this column to:

    { Distance m = n;
      if (m >= 0)
        while (m--) --r;
      else
        while (m++) ++r;
      return r; }
Date: 2010-10-21.18:28:33

[ 2009-10 Santa Cruz: ]

The group reviewed the wording in the draft and agreed that n is of difference type, the difference type is signed, and the current wording is correct. Moved to NAD.

Date: 2011-03-05.00:04:13

[ 2009-07 Frankfurt: ]

Need to look at again without concepts.

There was a question about this phrase in the discussion: "the expression -n must be valid, which is not the case for unsigned types." If n is an object of the iterator difference_type (eg ptrdiff_t), then it is never unsigned.

Date: 2010-10-21.18:28:33

[ Batavia (2009-05): ]

We agree with Alisdair's observations.

Move to NAD.

Date: 2010-10-21.18:28:33

[ Post Summit Alisdair adds: ]

This issue refers to a requirements table we have removed.

The issue might now relate to [random.access.iterators] p5. However, the rationale in the issue already recognises that the difference_type must be signed, so this really looks NAD.

Date: 2010-10-21.18:28:33

[ Sydney: Possibly not a real problem, since difference type is required to be a signed integer type. However, the wording in the standard may be less clear than we would like. ]

Date: 2004-02-27.00:00:00

In 24.1.5 [lib.random.access.iterators], table 76 the operational semantics for the expression "r -= n" are defined as "return r += -n". This means, that the expression -n must be valid, which is not the case for unsigned types.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg2710
2010-10-21 18:28:33adminsetmessages: + msg2709
2010-10-21 18:28:33adminsetmessages: + msg2708
2010-10-21 18:28:33adminsetmessages: + msg2707
2010-10-21 18:28:33adminsetmessages: + msg2706
2010-10-21 18:28:33adminsetmessages: + msg2705
2004-02-27 00:00:00admincreate