Title
BidirectionalIterator concept should provide default implementation for post-decrement
Status
nad concepts
Section
[bidirectional.iterators]
Submitter
Howard Hinnant

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

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Change [bidirectional.iterators]:

concept BidirectionalIterator<typename X> : ForwardIterator<X> { 
  MoveConstructible postdecrement_result; 
  requires HasDereference<postdecrement_result> 
        && Convertible<HasDereference<postdecrement_result>::result_type, const value_type&> 
        && Convertible<postdecrement_result, const X&>; 
  X& operator--(X&); 
  postdecrement_result operator--(X& r, int); {
     X tmp = r;
     --r;
     return tmp;
  }
}
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 postdecrement_result invalid, see 1084.

Date: 2010-10-21.18:28:33

[ Summit: ]

Howard will open an issue.

Date: 2012-10-21.13:19:07

Addresses UK 258 [CD1]

A default implementation should be supplied for the post-decrement 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: + msg643
2010-10-21 18:28:33adminsetmessages: + msg642
2010-10-21 18:28:33adminsetmessages: + msg641
2009-03-22 00:00:00admincreate