]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/iter.pass.cpp
Vendor import of libc++ trunk r290819:
[FreeBSD/FreeBSD.git] / test / std / iterators / predef.iterators / move.iterators / move.iter.ops / move.iter.op.const / iter.pass.cpp
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 // explicit move_iterator(Iter i);
15 //
16 //  constexpr in C++17
17
18 #include <iterator>
19 #include <cassert>
20
21 #include "test_macros.h"
22 #include "test_iterators.h"
23
24 template <class It>
25 void
26 test(It i)
27 {
28     std::move_iterator<It> r(i);
29     assert(r.base() == i);
30 }
31
32 int main()
33 {
34     char s[] = "123";
35     test(input_iterator<char*>(s));
36     test(forward_iterator<char*>(s));
37     test(bidirectional_iterator<char*>(s));
38     test(random_access_iterator<char*>(s));
39     test(s);
40
41 #if TEST_STD_VER > 14
42     {
43     constexpr const char *p = "123456789";
44     constexpr std::move_iterator<const char *> it(p);
45     static_assert(it.base() == p);
46     }
47 #endif
48 }