This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.
transform_view::iterator
has incorrect iterator_category
Section: 25.7.9.3 [range.transform.iterator] Status: C++20 Submitter: Michel Morin Opened: 2019-10-03 Last modified: 2021-02-25
Priority: 1
View all other issues in [range.transform.iterator].
View all issues with C++20 status.
Discussion:
When the transformation function returns an rvalue, transform_view::iterator
cannot model cpp17-forward-iterator
. However, similar to LWG 3291(i),
the current wording on transform_view::iterator::iterator_category
does not
consider this.
input_iterator
that is not
cpp17-input-iterator
(this problem is not specific to the PR; it's pervasive
in adapted iterators) and concepts-based determination would be a better fix for issues around
iterator_category
. But anyway, I consider this PR as a minimal fix at the moment.
[2019-10-31 Issue Prioritization]
Priority to 1 after reflector discussion.
Previous resolution [SUPERSEDED]:This wording is relative to N4830.
Modify 25.7.9.3 [range.transform.iterator] as indicated:
-2-
iterator::iterator_category
is defined as follows: LetC
denote the typeiterator_traits<iterator_t<Base>>::iterator_category
.
(2.?) — If
is_lvalue_reference_v<iter_reference_t<iterator_t<Base>>>
istrue
,
(2.?.?) — If
C
modelsderived_from<contiguous_iterator_tag>
, theniterator_category
denotesrandom_access_iterator_tag
;(2.?.?) — O
otherwise,iterator_category
denotesC
.(2.?) — Otherwise,
iterator_category
denotesinput_iterator_tag
.
[2019-11-06, Tim updates P/R based on Belfast LWG evening session discussion]
The check in the original P/R is incorrect; we want to check the transformation's result, not the base iterator.
[2020-02-10 Move to Immediate Monday afternoon in Prague]
Proposed resolution:
This wording is relative to N4830.
Modify 25.7.9.3 [range.transform.iterator] as indicated:
-2-
iterator::iterator_category
is defined as follows: LetC
denote the typeiterator_traits<iterator_t<Base>>::iterator_category
.
(2.?) — If
is_lvalue_reference_v<invoke_result_t<F&, range_reference_t<Base>>>
istrue
,
(2.?.?) — If
C
modelsderived_from<contiguous_iterator_tag>
, theniterator_category
denotesrandom_access_iterator_tag
;(2.?.?) — O
otherwise,iterator_category
denotesC
.(2.?) — Otherwise,
iterator_category
denotesinput_iterator_tag
.