2285. make_reverse_iterator

Section: 27.5.1 [reverse.iterators] Status: C++14 Submitter: Zhihao Yuan Opened: 2013-08-27 Last modified: 2016-02-10

Priority: Not Prioritized

View all other issues in [reverse.iterators].

View all issues with C++14 status.

Discussion:

We have make_move_iterator, but not make_reverse_iterator, which is also useful when dealing with some types without an rbegin/rend support (like, C strings).

[2013-09 Chicago]

Billy: reviewed it last night STL: has suggested prior, but denied for complexity

Billy: Alisdair wanted to review for reverse(reverse());

STL: likes the issue, was like him

Stefanus: likes definitions, places where things should be

STL: for consistency with make_move_iterator

Stefanus: minor editorial issue - subdivision in these 2 sections is different from [move.iter]. See 27.5.3.3.14 [move.iter.nonmember]

STL: motion to move to Ready

Move to Ready

Proposed resolution:

This wording is relative to N3691.

  1. Change header <iterator> synopsis, 27.3 [iterator.synopsis] as indicated:

    namespace std {
      […]
      template <class Iterator>
        reverse_iterator<Iterator> operator+(
          typename reverse_iterator<Iterator>::difference_type n,
          const reverse_iterator<Iterator>& x);
    
      template <class Iterator>
        reverse_iterator<Iterator> make_reverse_iterator(Iterator i);
    
    }
    
  2. Change class template reverse_iterator synopsis, 27.5.1.1 [reverse.iterator] as indicated:

    namespace std {
      […]
      template <class Iterator>
        reverse_iterator<Iterator> operator+(
          typename reverse_iterator<Iterator>::difference_type n,
          const reverse_iterator<Iterator>& x);
    
      template <class Iterator>
        reverse_iterator<Iterator> make_reverse_iterator(Iterator i);
    
    }
    
  3. After 27.5.1.3.20 [reverse.iter.opsum] add the following new sub-clause to 27.5.1.3 [reverse.iter.ops]:

    
    template <class Iterator>
      reverse_iterator<Iterator> make_reverse_iterator(Iterator i);
    
    

    -?- Returns: reverse_iterator<Iterator>(i).