This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++17 status.
Section: 184.108.40.206 [iterator.iterators] Status: C++17 Submitter: Stephan T. Lavavej Opened: 2014-10-01 Last modified: 2017-07-30
View all other issues in [iterator.iterators].
View all issues with C++17 status.
220.127.116.11 [iterator.iterators]/2 requires an Iterator's *r to return reference, i.e. iterator_traits<X>::reference according to 23.3.1 [iterator.requirements.general]/18.104.22.168.4 [output.iterators]/1 requires an OutputIterator's *r = o to do its job, so *r clearly can't return void. 22.214.171.124 [iterator.traits]/1 says: "In the case of an output iterator, the types
iterator_traits<Iterator>::difference_type iterator_traits<Iterator>::value_type iterator_traits<Iterator>::reference iterator_traits<Iterator>::pointer
may be defined as void."This is contradictory. I suggest fixing this by moving the offending requirement down from Iterator to InputIterator, and making Iterator say that *r returns an unspecified type. This will have the following effects:
Output-only iterators will inherit Iterator's "*r returns unspecified" requirement, while 126.96.36.199 [iterator.traits]/1 clearly permits reference/etc. to be void.
Input-or-stronger iterators (whether constant or mutable) are unaffected — they still have to satisfy "*r returns reference", they're just getting that requirement from InputIterator instead of Iterator.
EF: This is related to 2438. MC: I'd like to take up 2438 right after this.AM: Does anyone think this is wrong? GR: Why do we give output iterators to have reference type void? AM: we've mandated that certain output iterators define it as void since 1998. GR: Oh OK, I'm satisfied. Accepted. And 2438 is already Ready.
This wording is relative to N3936.
In 188.8.131.52 [iterator.iterators] Table 106 "Iterator requirements" change as indicated:
Table 106 — Iterator requirements Expression Return type Operational
Assertion/note pre-/post-condition *r reference pre: r is dereferenceable. …
In 184.108.40.206 [input.iterators] Table 107 "Input iterator requirements" change as indicated:
Table 107 — Input iterator requirements (in addition to Iterator) Expression Return type Operational
Assertion/note pre-/post-condition … *a convertible to T […] …