Created on 2022-11-23.00:00:00 last changed 5 months ago
Proposed resolution:
This wording is relative to N4986.
Modify [range.elements.iterator] as indicated:
-2- The member typedef-name
iterator_category
is defined if and only ifBase
modelsforward_range
. In that case,iterator_category
is defined as follows: LetC
denote the typeiterator_traits<iterator_t<Base>>::iterator_category
.
(2.1) — If
is_reference_v<decltype(get-element(current_))> isstd::get<N>(*current_)
an rvaluefalse,iterator_category
denotesinput_iterator_tag
.(2.2) — Otherwise, if
C
modelsderived_from<random_access_iterator_tag>
,iterator_category
denotesrandom_access_iterator_tag
.(2.3) — Otherwise,
iterator_category
denotesC
.
[ 2024-07-08; Hewill Kang provides improved wording ]
[ 2023-01-22; Jiang An comments and provides improved wording ]
The old proposed resolution was incorrect. I think the correct criteria could be that determined from the return type of get-element.
This wording is relative to N4928.
Modify [range.elements.iterator] as indicated:
-2- The member typedef-name iterator_category is defined if and only if Base models forward_range. In that case, iterator_category is defined as follows: Let C denote the type iterator_traits<iterator_t<Base>>::iterator_category.
(2.1) — If range_reference_t<Base> is a reference type and std::get<N>(*current_) is a
nprvalue or neither range_reference_t<Base> nor tuple_element_t<N, range_reference_t<Base> is a reference type, iterator_category denotes input_iterator_tag.(2.2) — Otherwise, if C models derived_from<random_access_iterator_tag>, iterator_category denotes random_access_iterator_tag.
(2.3) — Otherwise, iterator_category denotes C.
[ 2022-11-30; Reflector poll ]
Set priority to 3 after reflector poll.
"The proposed resolution is incorrect - just because the get expression is an xvalue doesn't mean operator* returns by reference."
Previous resolution [SUPERSEDED]:
This wording is relative to N4917.
Modify [range.elements.iterator] as indicated:
-2- The member typedef-name iterator_category is defined if and only if Base models forward_range. In that case, iterator_category is defined as follows: Let C denote the type iterator_traits<iterator_t<Base>>::iterator_category.
(2.1) — If std::get<N>(*current_) is a
nprvalue, iterator_category denotes input_iterator_tag.(2.2) — Otherwise, if C models derived_from<random_access_iterator_tag>, iterator_category denotes random_access_iterator_tag.
(2.3) — Otherwise, iterator_category denotes C.
In LWG 3798 (voted into WP in November 2022), iterator types of several range adaptors may have forward_iterator_tag or stronger iterator tag types as their iterator_category type when their operator* returns rvalue references. However, the proposed resolution missed the similar change for element_view::iterator.
History | |||
---|---|---|---|
Date | User | Action | Args |
2024-07-21 08:18:15 | admin | set | messages: + msg14251 |
2023-01-28 12:16:49 | admin | set | messages: + msg13217 |
2022-11-30 10:08:16 | admin | set | messages: + msg13128 |
2022-11-26 12:42:02 | admin | set | messages: + msg13116 |
2022-11-23 00:00:00 | admin | create |