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 <RandomAccessIterator Iter>
15 //   move_iterator<Iter>
16 //   operator+(Iter::difference_type n, const move_iterator<Iter>& x);
17 
18 #include <iterator>
19 #include <cassert>
20 
21 #include "test_iterators.h"
22 
23 template <class It>
24 void
test(It i,typename std::iterator_traits<It>::difference_type n,It x)25 test(It i, typename std::iterator_traits<It>::difference_type n, It x)
26 {
27     const std::move_iterator<It> r(i);
28     std::move_iterator<It> rr = n + r;
29     assert(rr.base() == x);
30 }
31 
main()32 int main()
33 {
34     char s[] = "1234567890";
35     test(random_access_iterator<char*>(s+5), 5, random_access_iterator<char*>(s+10));
36     test(s+5, 5, s+10);
37 }
38