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

2105. Inconsistent requirements on const_iterator's value_type

Section: 24.2.2.1 [container.requirements.general] Status: C++14 Submitter: Jeffrey Yasskin Opened: 2011-11-28 Last modified: 2016-01-28

Priority: Not Prioritized

View other active issues in [container.requirements.general].

View all other issues in [container.requirements.general].

View all issues with C++14 status.

Discussion:

In the FDIS, Table 96 specifies X::const_iterator as a "constant iterator type whose value type is T". However, Table 97 specifies X::const_reverse_iterator as an "iterator type whose value type is const T" and which is defined as reverse_iterator<const_iterator>. But reverse_iterator::value_type is just "typename iterator_traits<Iterator>::value_type" 25.5.1.2 [reverse.iterator], so const_iterator and const_reverse_iterator must have the same value_type.

The resolution to issue 322 implies that const_reverse_iterator should change.

[2012, Kona]

Move to Ready.

[2012, Portland: applied to WP]

Proposed resolution:

This wording is relative to the FDIS.

Change Table 97 — "Reversible container requirements" as indicated

Table 97 — Reversible container requirements
Expression Return type Assertion/note pre-/post-condition Complexity
X::reverse_-
iterator
iterator type whose value type
is T
reverse_iterator<iterator> compile time
X::const_-
reverse_-
iterator
constant iterator type whose value type
is const T
reverse_iterator<const_iterator> compile time