Title
reverse_iterator::operator[]'s return type revisited
Status
new
Section
[reverse.iterator][reverse.iter.elem]
Submitter
Robert Haberlach

Created on 2016-02-28.00:00:00 last changed 43 months ago

Messages

Date: 2021-06-06.18:38:24

Proposed resolution:

This wording is relative to N4885.

  1. Edit [reverse.iterator], class template synopsis, as indicated:

    namespace std {
      template <class Iterator>
      class reverse_iterator {
      public:
        […]
        using reference         = iter_reference_t<Iterator>;
        […]
        constexpr referenceunspecified operator[](difference_type n) const;
        […]
      };
    }
    
  2. Change [reverse.iter.elem] before p3 as indicated:

    constexpr referenceunspecified operator[](difference_type n) const;
    
Date: 2021-06-06.00:00:00

[ 2021-06-06 Tim syncs wording to current working draft ]

Date: 2021-06-06.18:38:24

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 [reverse.iterator]'s synopsis and [reverse.iter.elem] to use reference instead of unspecified.

History
Date User Action Args
2021-06-06 18:38:24adminsetmessages: + msg11880
2016-04-07 20:04:09adminsetmessages: + msg8027
2016-02-28 00:00:00admincreate