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// requires RandomAccessIterator<Iter>
15//   move_iterator operator-(difference_type n) const;
16
17#include <iterator>
18#include <cassert>
19
20#include "test_iterators.h"
21
22template <class It>
23void
24test(It i, typename std::iterator_traits<It>::difference_type n, It x)
25{
26    const std::move_iterator<It> r(i);
27    std::move_iterator<It> rr = r - n;
28    assert(rr.base() == x);
29}
30
31int main()
32{
33    const char* s = "1234567890";
34    test(random_access_iterator<const char*>(s+5), 5, random_access_iterator<const char*>(s));
35    test(s+5, 5, s);
36}
37