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 <RandomAccessIterator Iter1, RandomAccessIterator Iter2> 15 // requires HasGreater<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 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 33 int main() 34 { 35 const char* s = "1234567890"; 36 test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s), false); 37 test(random_access_iterator<const char*>(s), random_access_iterator<const char*>(s+1), true); 38 test(random_access_iterator<const char*>(s+1), random_access_iterator<const char*>(s), false); 39 test(s, s, false); 40 test(s, s+1, true); 41 test(s+1, s, false); 42 } 43