2061. make_move_iterator and arrays

Section: 27.3 [iterator.synopsis], 27.5.3 [move.iterators] Status: C++14 Submitter: Marc Glisse Opened: 2011-05-28 Last modified: 2016-02-10

Priority: Not Prioritized

View all other issues in [iterator.synopsis].

View all issues with C++14 status.

Discussion:

The standard library always passes template iterators by value and never by reference, which has the nice effect that an array decays to a pointer. There is one exception: make_move_iterator.

#include <iterator>
int main(){
  int a[]={1,2,3,4};
  std::make_move_iterator(a+4);
  std::make_move_iterator(a); // fails here
}

[ 2011 Bloomington. ]

Move to Ready.

Proposed resolution:

This wording is relative to the FDIS.

  1. Modify the header <iterator> synopsis in 27.3 [iterator.synopsis]:

    namespace std {
      […]
      template <class Iterator>
      move_iterator<Iterator> make_move_iterator(const Iterator&Iterator i);
    
      […]
    }
    
  2. Modify the class template move_iterator synopsis in 27.5.3.1 [move.iterator]:

    namespace std {
      […]
      template <class Iterator>
      move_iterator<Iterator> make_move_iterator(const Iterator&Iterator i);
    }
    
  3. Modify 27.5.3.3.14 [move.iter.nonmember]:

    template <class Iterator>
    move_iterator<Iterator> make_move_iterator(const Iterator&Iterator i);
    

    -3- Returns: move_iterator<Iterator>(i).