This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
Section: 25.5.1.6 [reverse.iter.elem] Status: New Submitter: Hewill Kang Opened: 2022-06-26 Last modified: 2022-07-09
Priority: 3
View all other issues in [reverse.iter.elem].
View all issues with New status.
Discussion:
When the underlying iterator is not a pointer type, reverse_iterator::operator-> returns prev(current).operator->(). However, prev only works with Cpp17BidirectionalIterator, given that C++20 bidirectional_iterator may just be Cpp17InputIterator, we shouldn't use prev here.
[2022-07-08; Reflector poll]
Set priority to 3 after reflector poll.
Suggested to use ranges::prev
instead.
Proposed resolution:
This wording is relative to N4910.
Modify 25.5.1.6 [reverse.iter.elem] as indicated:
constexpr pointer operator->() const requires (is_pointer_v<Iterator> || requires(const Iterator i) { i.operator->(); });-2- Effects:
(2.1) — If Iterator is a pointer type, equivalent to: return prev(current);
(2.2) — Otherwise, equivalent to:
return prev(current).operator->();Iterator tmp = current; --tmp; return tmp.operator->();