Title
Concept ForwardIterator should provide default implementation for post-increment
Status
nad concepts
Section
[forward.iterators]
Submitter
Howard Hinnant

Created on 2009-03-22.00:00:00 last changed 164 months ago

Messages

Date: 2010-10-21.18:28:33

[ This wording assumes the acceptance of UK 251 / 1009. Both wordings change the same paragraphs. ]

Change [forward.iterators]:

concept ForwardIterator<typename X> : InputIterator<X>, Regular<X> { 

  MoveConstructible postincrement_result;
  requires HasDereference<postincrement_result>
        && Convertible<HasDereference<postincrement_result>::result_type, const value_type&>;

  postincrement_result operator++(X& r, int); {
     X tmp = r;
     ++r;
     return tmp;
  }

  axiom MultiPass(X a, X b) { 
    if (a == b) *a == *b; 
    if (a == b) ++a == ++b; 
  } 
}
Date: 2009-06-07.00:00:00

[ 2009-06-07 Daniel adds: ]

This issue cannot currently be resolved as suggested, because that would render auto-detection of the return type postincrement_result invalid, see [concept.map.assoc]/4+5. The best fix would be to add a default type to that associated type, but unfortunately any default type will prevent auto-deduction of types of associated functions as quoted above. A corresponding core issue is in preparation.

Date: 2010-10-21.18:28:33

[ Summit: ]

Howard will open an issue.

Date: 2012-10-21.13:19:07

Addresses UK 250 [CD1]

A default implementation should be supplied for the post-increment operator to simplify implementation of iterators by users.

Copy the Effects clause into the concept description as the default implementation. Assumes a default value for postincrement_result.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg639
2010-10-21 18:28:33adminsetmessages: + msg638
2010-10-21 18:28:33adminsetmessages: + msg637
2009-03-22 00:00:00admincreate