589. Requirements on iterators of member template functions of containers

Section: 23.2 [container.requirements] Status: CD1 Submitter: Peter Dimov Opened: 2006-08-02 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [container.requirements].

View all issues with CD1 status.

Duplicate of: 536

Discussion:

There appears to be no requirements on the InputIterators used in sequences in 23.1.1 in terms of their value_type, and the requirements in 23.1.2 appear to be overly strict (requires InputIterator::value_type be the same type as the container's value_type).

Proposed resolution:

Change 23.1.1 p3:

In Tables 82 and 83, X denotes a sequence class, a denotes a value of X, i and j denote iterators satisfying input iterator requirements and refer to elements implicitly convertible to value_type, [i, j) denotes a valid range, n denotes a value of X::size_type, p denotes a valid iterator to a, q denotes a valid dereferenceable iterator to a, [q1, q2) denotes a valid range in a, and t denotes a value of X::value_type.

Change 23.1.2 p7:

In Table 84, X is an associative container class, a is a value of X, a_uniq is a value of X when X supports unique keys, and a_eq is a value of X when X supports multiple keys, i and j satisfy input iterator requirements and refer to elements of implicitly convertible to value_type, [i, j) is a valid range, p is a valid iterator to a, q is a valid dereferenceable iterator to a, [q1, q2) is a valid range in a, t is a value of X::value_type, k is a value of X::key_type and c is a value of type X::key_compare.

Rationale:

Concepts will probably come in and rewrite this section anyway. But just in case it is easy to fix this up as a safety net and as a clear statement of intent.