3858. basic_const_iterator is too strict to provide iterator_category

Section: 24.5.3.4 [const.iterators.types] Status: NAD Submitter: Hewill Kang Opened: 2023-01-22 Last modified: 2023-02-06

Priority: Not Prioritized

View all issues with NAD status.

Discussion:

Currently, basic_const_iterator provides iterator_category member only when the underlying iterator models forward_iterator, which means that it will not provide input_iterator_tag when applied to any C++17 legacy iterator.

This seems undesirable, and it should be more appropriate to provide iterator_category only by detecting whether the iterator_traits specialization of the underlying iterator has a valid iterator_category, as is common practice for other iterator adaptors in <iterator>.

[2023-02-06 Status changed: New → NAD.]

Set status to NAD after reflector poll.

Proposed resolution:

This wording is relative to N4928.

  1. Modify 24.5.3.4 [const.iterators.types] as indicated:

    -2- The member typedef-name iterator_category is defined if and only if the qualified-id iterator_traits<Iterator>::iterator_category is valid and denotes a typeIterator models forward_iterator. In that case, basic_const_iterator<Iterator>::iterator_category denotes the type iterator_traits<Iterator>::iterator_category.