1 | //===----------------------------------------------------------------------===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | // UNSUPPORTED: c++03, c++11, c++14, c++17 |
10 | |
11 | // iterator, const_iterator, local_iterator, const_local_iterator |
12 | |
13 | #include <unordered_set> |
14 | |
15 | #include <iterator> |
16 | |
17 | #include "test_macros.h" |
18 | |
19 | using iterator = std::unordered_set<int>::iterator; |
20 | using const_iterator = std::unordered_set<int>::const_iterator; |
21 | using local_iterator = std::unordered_set<int>::local_iterator; |
22 | using const_local_iterator = std::unordered_set<int>::const_local_iterator; |
23 | using value_type = int; |
24 | |
25 | static_assert(std::forward_iterator<iterator>); |
26 | LIBCPP_STATIC_ASSERT(!std::bidirectional_iterator<iterator>); |
27 | static_assert(!std::indirectly_writable<iterator, value_type>); |
28 | static_assert(std::sentinel_for<iterator, iterator>); |
29 | static_assert(std::sentinel_for<iterator, const_iterator>); |
30 | static_assert(!std::sized_sentinel_for<iterator, iterator>); |
31 | static_assert(!std::sized_sentinel_for<iterator, const_iterator>); |
32 | static_assert(std::indirectly_movable<iterator, int*>); |
33 | static_assert(std::indirectly_movable_storable<iterator, int*>); |
34 | static_assert(std::indirectly_copyable<iterator, int*>); |
35 | static_assert(std::indirectly_copyable_storable<iterator, int*>); |
36 | static_assert(!std::indirectly_swappable<iterator, iterator>); |
37 | |
38 | static_assert(std::forward_iterator<const_iterator>); |
39 | LIBCPP_STATIC_ASSERT(!std::bidirectional_iterator<const_iterator>); |
40 | static_assert(!std::indirectly_writable<const_iterator, value_type>); |
41 | static_assert(std::sentinel_for<const_iterator, iterator>); |
42 | static_assert(std::sentinel_for<const_iterator, const_iterator>); |
43 | static_assert(!std::sized_sentinel_for<const_iterator, iterator>); |
44 | static_assert(!std::sized_sentinel_for<const_iterator, const_iterator>); |
45 | static_assert(std::indirectly_movable<const_iterator, int*>); |
46 | static_assert(std::indirectly_movable_storable<const_iterator, int*>); |
47 | static_assert(std::indirectly_copyable<const_iterator, int*>); |
48 | static_assert(std::indirectly_copyable_storable<const_iterator, int*>); |
49 | static_assert(!std::indirectly_swappable<const_iterator, const_iterator>); |
50 | |
51 | static_assert(std::forward_iterator<local_iterator>); |
52 | LIBCPP_STATIC_ASSERT(!std::bidirectional_iterator<local_iterator>); |
53 | static_assert(std::sentinel_for<local_iterator, local_iterator>); |
54 | static_assert(std::sentinel_for<local_iterator, const_local_iterator>); |
55 | static_assert(!std::sized_sentinel_for<local_iterator, local_iterator>); |
56 | static_assert(!std::sized_sentinel_for<local_iterator, const_local_iterator>); |
57 | static_assert(std::indirectly_movable<local_iterator, int*>); |
58 | static_assert(std::indirectly_movable_storable<local_iterator, int*>); |
59 | static_assert(std::indirectly_copyable<local_iterator, int*>); |
60 | static_assert(std::indirectly_copyable_storable<local_iterator, int*>); |
61 | static_assert(!std::indirectly_swappable<local_iterator, local_iterator>); |
62 | |
63 | static_assert(std::forward_iterator<const_local_iterator>); |
64 | LIBCPP_STATIC_ASSERT(!std::bidirectional_iterator<const_local_iterator>); |
65 | static_assert(!std::indirectly_writable<const_local_iterator, value_type>); |
66 | static_assert(std::sentinel_for<const_local_iterator, local_iterator>); |
67 | static_assert(std::sentinel_for<const_local_iterator, const_local_iterator>); |
68 | static_assert(!std::sized_sentinel_for<const_local_iterator, local_iterator>); |
69 | static_assert(!std::sized_sentinel_for<const_local_iterator, const_local_iterator>); |
70 | static_assert(std::indirectly_movable<const_local_iterator, int*>); |
71 | static_assert(std::indirectly_movable_storable<const_local_iterator, int*>); |
72 | static_assert(std::indirectly_copyable<const_local_iterator, int*>); |
73 | static_assert(std::indirectly_copyable_storable<const_local_iterator, int*>); |
74 | static_assert(!std::indirectly_swappable<const_local_iterator, const_local_iterator>); |
75 | |