903. back_insert_iterator issue

Section: 24.5.2.2 [back.insert.iterator] Status: NAD Submitter: Dave Abrahams Opened: 2008-09-19 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [back.insert.iterator].

View all issues with NAD status.

Discussion:

I just noticed this; don't know how far the problem(?) extends or whether it's new or existing: back_insert_iterator's operator* is not const, so you can't dereference a const one.

[ Post Summit Daniel adds: ]

If done, this change should be applied for front_insert_iterator, insert_iterator, ostream_iterator, and ostreambuf_iterator as well.

[ Batavia (2009-05): ]

Alisdair notes that these all are output iterators. Howard points out that ++*i would no longer work if we made this change.

Move to NAD.

[ 2009-05-25 Daniel adds: ]

  1. If 1009 is accepted, OutputIterator does no longer support post increment.
  2. To support backward compatibility a second overload of operator* can be added. Note that the HasDereference concept (and the HasDereference part of concept Iterator) was specifically refactored to cope with optional const qualification and to properly reflect the dual nature of built-in operator* as of 12.6 [over.literal]/6.

Proposed resolution: