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.2 [reverse.iterator], 25.5.1.6 [reverse.iter.elem] Status: New Submitter: Robert Haberlach Opened: 2016-02-28 Last modified: 2021-06-06
Priority: 3
View all other issues in [reverse.iterator].
View all issues with New status.
Discussion:
Issue 386 changed the return type of reverse_iterator::operator[] to unspecified. However, as of N3066, the return type of a random access iterator's operator[] shall be convertible to reference; thus the return type of reverse_iterator::operator[] should be reference (and it is in all common implementations).
Suggested resolution: Adjust 25.5.1.2 [reverse.iterator]'s synopsis and 25.5.1.6 [reverse.iter.elem] to use reference instead of unspecified.[2021-06-06 Tim syncs wording to current working draft]
Proposed resolution:
This wording is relative to N4885.
Edit 25.5.1.2 [reverse.iterator], class template synopsis, as indicated:
namespace std { template <class Iterator> class reverse_iterator { public: […] using reference = iter_reference_t<Iterator>; […] constexpr referenceunspecifiedoperator[](difference_type n) const; […] }; }
Change 25.5.1.6 [reverse.iter.elem] before p3 as indicated:
constexpr referenceunspecifiedoperator[](difference_type n) const;