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 Iter1, InputIterator Iter2>
15 // requires HasEqualTo<Iter1, Iter2>
16 // bool
17 // operator!=(const move_iterator<Iter1>& x, const move_iterator<Iter2>& y);
18
19 #include <iterator>
20 #include <cassert>
21
22 #include "test_iterators.h"
23
24 template <class It>
25 void
test(It l,It r,bool x)26 test(It l, It r, bool x)
27 {
28 const std::move_iterator<It> r1(l);
29 const std::move_iterator<It> r2(r);
30 assert((r1 != r2) == x);
31 }
32
main()33 int main()
34 {
35 char s[] = "1234567890";
36 test(input_iterator<char*>(s), input_iterator<char*>(s), false);
37 test(input_iterator<char*>(s), input_iterator<char*>(s+1), true);
38 test(forward_iterator<char*>(s), forward_iterator<char*>(s), false);
39 test(forward_iterator<char*>(s), forward_iterator<char*>(s+1), true);
40 test(bidirectional_iterator<char*>(s), bidirectional_iterator<char*>(s), false);
41 test(bidirectional_iterator<char*>(s), bidirectional_iterator<char*>(s+1), true);
42 test(random_access_iterator<char*>(s), random_access_iterator<char*>(s), false);
43 test(random_access_iterator<char*>(s), random_access_iterator<char*>(s+1), true);
44 test(s, s, false);
45 test(s, s+1, true);
46 }
47