1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
14 // template <RandomAccessIterator Iterator>
15 // constexpr reverse_iterator<Iter>
16 // operator+(Iter::difference_type n, const reverse_iterator<Iter>& x);
23 #include "test_macros.h"
24 #include "test_iterators.h"
28 test(It i, typename std::iterator_traits<It>::difference_type n, It x)
30 const std::reverse_iterator<It> r(i);
31 std::reverse_iterator<It> rr = n + r;
32 assert(rr.base() == x);
37 const char* s = "1234567890";
38 test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s));
43 constexpr const char *p = "123456789";
44 typedef std::reverse_iterator<const char *> RI;
45 constexpr RI it1 = std::make_reverse_iterator(p);
46 constexpr RI it2 = std::make_reverse_iterator(p + 5);
47 constexpr RI it3 = 5 + it2;
48 static_assert(it1 != it2, "");
49 static_assert(it1 == it3, "");
50 static_assert(it2 != it3, "");