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 <class U>
15 //   requires HasConstructor<Iter, const U&>
16 //   move_iterator(const move_iterator<U> &u);
17 
18 #include <iterator>
19 #include <cassert>
20 
21 #include "test_iterators.h"
22 
23 template <class It, class U>
24 void
25 test(U u)
26 {
27     const std::move_iterator<U> r2(u);
28     std::move_iterator<It> r1 = r2;
29     assert(r1.base() == u);
30 }
31 
32 struct Base {};
33 struct Derived : Base {};
34 
35 int main()
36 {
37     Derived d;
38 
39     test<input_iterator<Base*> >(input_iterator<Derived*>(&d));
40     test<forward_iterator<Base*> >(forward_iterator<Derived*>(&d));
41     test<bidirectional_iterator<Base*> >(bidirectional_iterator<Derived*>(&d));
42     test<random_access_iterator<const Base*> >(random_access_iterator<Derived*>(&d));
43     test<Base*>(&d);
44 }
45