Created on 2001-05-17.00:00:00 last changed 172 months ago
Rationale:
This belongs as a container requirement, rather than an iterator requirement, because the whole notion of iterator/const_iterator pairs is specific to containers' iterator.
It is existing practice that (for example) iterator_traits<list<int>::const_iterator>::value_type is "int", rather than "const int". This is consistent with the way that const pointers are handled: the standard already requires that iterator_traits<const int*>::value_type is int.
Proposed resolution:
In Table 65 ("Container Requirements"), change the return type for X::iterator to "iterator type whose value type is T". Change the return type for X::const_iterator to "constant iterator type whose value type is T".
It's widely assumed that, if X is a container, iterator_traits<X::iterator>::value_type and iterator_traits<X::const_iterator>::value_type should both be X::value_type. However, this is nowhere stated. The language in Table 65 is not precise about the iterators' value types (it predates iterator_traits), and could even be interpreted as saying that iterator_traits<X::const_iterator>::value_type should be "const X::value_type".
Related issue: 279.
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-10-21 18:28:33 | admin | set | messages: + msg2230 |
2010-10-21 18:28:33 | admin | set | messages: + msg2229 |
2001-05-17 00:00:00 | admin | create |