iota_view::iterator::iterator_concept should be improvedSection: 25.6.4.3 [range.iota.iterator] Status: New Submitter: Hewill Kang Opened: 2023-10-27 Last modified: 2023-11-07
Priority: 3
View other active issues in [range.iota.iterator].
View all other issues in [range.iota.iterator].
View all issues with New status.
Discussion:
When W models incrementable, the iota_view iterator will be a forward_iterator,
which accidentally makes iota_view<istream_iterator<int>> satisfies forward_range,
which is obviously incorrect.
W, it seems more appropriate and accurate to define
the iterator_concept through the iterator concept in this case.
[2023-11-07; Reflector poll]
Set priority to 3 after reflector poll.
"This would change the iterator concept for types which model advanceable but do not model random_access_iterator. A type with +=
and -= and operator* will currently get random_access_iterator_tag
but this proposed resolution would change it to bidirectional_iterator_tag."
"If we want to handle this case (and not leave it as IFNDR - the type
satisfies-but-not-models incrementable) then we need to account
for it everywhere we are currently using incrementable
(and possibly equality_comparable?), and not just in the concept."
Proposed resolution:
This wording is relative to N4964.
Modify 25.6.4.3 [range.iota.iterator] as indicated:
[Drafting note: When
Wonly modelsinput_or_output_iterator, it implies that its pre- and post-increment are not equality-preserving, soiterator_conceptshould beinput_iterator_tag.]
-1-
iterator::iterator_conceptis defined as follows:
(?.?) — If
Wmodelsinput_or_output_iterator, then
(?.?) — if
Wmodelsrandom_access_iterator, theniterator_conceptisrandom_access_iterator_tag;(?.?) — otherwise, if
Wmodelsbidirectional_iterator, theniterator_conceptisbidirectional_iterator_tag;(?.?) — otherwise, if
Wmodelsforward_iterator, theniterator_conceptisforward_iterator_tag;(?.?) — otherwise,
iterator_conceptisinput_iterator_tag.(1.1) — Otherwise, i
IfWmodelsadvanceable, theniterator_conceptisrandom_access_iterator_tag.(1.2) — Otherwise, if
Wmodelsdecrementable, theniterator_conceptisbidirectional_iterator_tag.(1.3) — Otherwise, if
Wmodelsincrementable, theniterator_conceptisforward_iterator_tag.(1.4) — Otherwise,
iterator_conceptisinput_iterator_tag.