1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // <iterator> 11 12 // move_iterator 13 14 // template <InputIterator Iter> 15 // move_iterator<Iter> 16 // make_move_iterator(const Iter& i); 17 18 #include <iterator> 19 #include <cassert> 20 21 #include "test_iterators.h" 22 23 template <class It> 24 void test(It i)25test(It i) 26 { 27 const std::move_iterator<It> r(i); 28 assert(std::make_move_iterator(i) == r); 29 } 30 main()31int main() 32 { 33 { 34 char s[] = "1234567890"; 35 test(input_iterator<char*>(s+5)); 36 test(forward_iterator<char*>(s+5)); 37 test(bidirectional_iterator<char*>(s+5)); 38 test(random_access_iterator<char*>(s+5)); 39 test(s+5); 40 } 41 { 42 int a[] = {1,2,3,4}; 43 std::make_move_iterator(a+4); 44 std::make_move_iterator(a); // test for LWG issue 2061 45 } 46 } 47