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