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
19using iterator = std::unordered_set<int>::iterator;
20using const_iterator = std::unordered_set<int>::const_iterator;
21using local_iterator = std::unordered_set<int>::local_iterator;
22using const_local_iterator = std::unordered_set<int>::const_local_iterator;
23using value_type = int;
24
25static_assert(std::forward_iterator<iterator>);
26LIBCPP_STATIC_ASSERT(!std::bidirectional_iterator<iterator>);
27static_assert(!std::indirectly_writable<iterator, value_type>);
28static_assert(std::sentinel_for<iterator, iterator>);
29static_assert(std::sentinel_for<iterator, const_iterator>);
30static_assert(!std::sized_sentinel_for<iterator, iterator>);
31static_assert(!std::sized_sentinel_for<iterator, const_iterator>);
32static_assert(std::indirectly_movable<iterator, int*>);
33static_assert(std::indirectly_movable_storable<iterator, int*>);
34static_assert(std::indirectly_copyable<iterator, int*>);
35static_assert(std::indirectly_copyable_storable<iterator, int*>);
36static_assert(!std::indirectly_swappable<iterator, iterator>);
37
38static_assert(std::forward_iterator<const_iterator>);
39LIBCPP_STATIC_ASSERT(!std::bidirectional_iterator<const_iterator>);
40static_assert(!std::indirectly_writable<const_iterator, value_type>);
41static_assert(std::sentinel_for<const_iterator, iterator>);
42static_assert(std::sentinel_for<const_iterator, const_iterator>);
43static_assert(!std::sized_sentinel_for<const_iterator, iterator>);
44static_assert(!std::sized_sentinel_for<const_iterator, const_iterator>);
45static_assert(std::indirectly_movable<const_iterator, int*>);
46static_assert(std::indirectly_movable_storable<const_iterator, int*>);
47static_assert(std::indirectly_copyable<const_iterator, int*>);
48static_assert(std::indirectly_copyable_storable<const_iterator, int*>);
49static_assert(!std::indirectly_swappable<const_iterator, const_iterator>);
50
51static_assert(std::forward_iterator<local_iterator>);
52LIBCPP_STATIC_ASSERT(!std::bidirectional_iterator<local_iterator>);
53static_assert(std::sentinel_for<local_iterator, local_iterator>);
54static_assert(std::sentinel_for<local_iterator, const_local_iterator>);
55static_assert(!std::sized_sentinel_for<local_iterator, local_iterator>);
56static_assert(!std::sized_sentinel_for<local_iterator, const_local_iterator>);
57static_assert(std::indirectly_movable<local_iterator, int*>);
58static_assert(std::indirectly_movable_storable<local_iterator, int*>);
59static_assert(std::indirectly_copyable<local_iterator, int*>);
60static_assert(std::indirectly_copyable_storable<local_iterator, int*>);
61static_assert(!std::indirectly_swappable<local_iterator, local_iterator>);
62
63static_assert(std::forward_iterator<const_local_iterator>);
64LIBCPP_STATIC_ASSERT(!std::bidirectional_iterator<const_local_iterator>);
65static_assert(!std::indirectly_writable<const_local_iterator, value_type>);
66static_assert(std::sentinel_for<const_local_iterator, local_iterator>);
67static_assert(std::sentinel_for<const_local_iterator, const_local_iterator>);
68static_assert(!std::sized_sentinel_for<const_local_iterator, local_iterator>);
69static_assert(!std::sized_sentinel_for<const_local_iterator, const_local_iterator>);
70static_assert(std::indirectly_movable<const_local_iterator, int*>);
71static_assert(std::indirectly_movable_storable<const_local_iterator, int*>);
72static_assert(std::indirectly_copyable<const_local_iterator, int*>);
73static_assert(std::indirectly_copyable_storable<const_local_iterator, int*>);
74static_assert(!std::indirectly_swappable<const_local_iterator, const_local_iterator>);
75

source code of libcxx/test/std/containers/unord/unord.set/iterator_concept_conformance.compile.pass.cpp