This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++14 status.

2061. make_move_iterator and arrays

Section: 25.2 [iterator.synopsis], 25.5.4 [move.iterators] Status: C++14 Submitter: Marc Glisse Opened: 2011-05-28 Last modified: 2016-01-28

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 25.2 [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 25.5.4.2 [move.iterator]:

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

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

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