This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of CD1 status.

200. Forward iterator requirements don't allow constant iterators

Section: 25.3.5.5 [forward.iterators] Status: CD1 Submitter: Matt Austern Opened: 1999-11-19 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [forward.iterators].

View all issues with CD1 status.

Discussion:

In table 74, the return type of the expression *a is given as T&, where T is the iterator's value type. For constant iterators, however, this is wrong. ("Value type" is never defined very precisely, but it is clear that the value type of, say, std::list<int>::const_iterator is supposed to be int, not const int.)

Proposed resolution:

In table 74, in the *a and *r++ rows, change the return type from "T&" to "T& if X is mutable, otherwise const T&". In the a->m row, change the return type from "U&" to "U& if X is mutable, otherwise const U&".

[Tokyo: The LWG believes this is the tip of a larger iceberg; there are multiple const problems with the STL portion of the library and that these should be addressed as a single package.  Note that issue 180 has already been declared NAD Future for that very reason.]

[Redmond: the LWG thinks this is separable from other constness issues. This issue is just cleanup; it clarifies language that was written before we had iterator_traits. Proposed resolution was modified: the original version only discussed *a. It was pointed out that we also need to worry about *r++ and a->m.]