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 // reverse_iterator
13
14 // template <BidirectionalIterator Iter1, BidirectionalIterator Iter2>
15 // requires HasEqualTo<Iter1, Iter2>
16 // bool
17 // operator!=(const reverse_iterator<Iter1>& x, const reverse_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::reverse_iterator<It> r1(l);
29 const std::reverse_iterator<It> r2(r);
30 assert((r1 != r2) == x);
31 }
32
main()33 int main()
34 {
35 const char* s = "1234567890";
36 test(bidirectional_iterator<const char*>(s), bidirectional_iterator<const char*>(s), false);
37 test(bidirectional_iterator<const char*>(s), bidirectional_iterator<const char*>(s+1), true);
38 test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s), false);
39 test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+1), true);
40 test(s, s, false);
41 test(s, s+1, true);
42 }
43