Created on 2014-10-01.00:00:00 last changed 90 months ago
Proposed resolution:
This wording is relative to N3936.
In [iterator.iterators] Table 106 "Iterator requirements" change as indicated:
Table 106 — Iterator requirements Expression Return type Operational
semanticsAssertion/note pre-/post-condition *r referenceunspecifiedpre: r is dereferenceable. …
In [input.iterators] Table 107 "Input iterator requirements" change as indicated:
Table 107 — Input iterator requirements (in addition to Iterator) Expression Return type Operational
semanticsAssertion/note pre-/post-condition … *a reference, convertible to T […] …
[ 2015-02 Cologne ]
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.[iterator.iterators]/2 requires an Iterator's *r to return reference, i.e. iterator_traits<X>::reference according to [iterator.requirements.general]/11.
[output.iterators]/1 requires an OutputIterator's *r = o to do its job, so *r clearly can't return void. [iterator.traits]/1 says: "In the case of an output iterator, the typesiterator_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 [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.
History | |||
---|---|---|---|
Date | User | Action | Args |
2017-07-30 20:15:43 | admin | set | status: wp -> c++17 |
2015-05-22 18:31:21 | admin | set | status: ready -> wp |
2015-03-29 19:11:58 | admin | set | messages: + msg7272 |
2015-03-29 19:11:58 | admin | set | status: new -> ready |
2014-10-08 17:57:33 | admin | set | messages: + msg7133 |
2014-10-01 00:00:00 | admin | create |