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
W
only modelsinput_or_output_iterator
, it implies that its pre- and post-increment are not equality-preserving, soiterator_concept
should beinput_iterator_tag
.]
-1-
iterator::iterator_concept
is defined as follows:
(?.?) — If
W
modelsinput_or_output_iterator
, then
(?.?) — if
W
modelsrandom_access_iterator
, theniterator_concept
israndom_access_iterator_tag
;(?.?) — otherwise, if
W
modelsbidirectional_iterator
, theniterator_concept
isbidirectional_iterator_tag
;(?.?) — otherwise, if
W
modelsforward_iterator
, theniterator_concept
isforward_iterator_tag
;(?.?) — otherwise,
iterator_concept
isinput_iterator_tag
.(1.1) — Otherwise, i
IfW
modelsadvanceable
, theniterator_concept
israndom_access_iterator_tag
.(1.2) — Otherwise, if
W
modelsdecrementable
, theniterator_concept
isbidirectional_iterator_tag
.(1.3) — Otherwise, if
W
modelsincrementable
, theniterator_concept
isforward_iterator_tag
.(1.4) — Otherwise,
iterator_concept
isinput_iterator_tag
.