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_map>
14
15#include <iterator>
16
17#include "test_macros.h"
18
19using iterator = std::unordered_map<int, int>::iterator;
20using const_iterator = std::unordered_map<int, int>::const_iterator;
21using local_iterator = std::unordered_map<int, int>::local_iterator;
22using const_local_iterator = std::unordered_map<int, int>::const_local_iterator;
23using value_type = std::pair<const int, 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, std::pair<int, int>*>);
33static_assert(!std::indirectly_movable_storable<iterator, std::pair<int, int>*>);
34static_assert(std::indirectly_copyable<iterator, std::pair<int, int>*>);
35static_assert(!std::indirectly_copyable_storable<iterator, std::pair<int, 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, std::pair<int, int>*>);
46static_assert(!std::indirectly_movable_storable<const_iterator, std::pair<int, int>*>);
47static_assert(std::indirectly_copyable<const_iterator, std::pair<int, int>*>);
48static_assert(!std::indirectly_copyable_storable<const_iterator, std::pair<int, 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::indirectly_writable<local_iterator, value_type>);
54static_assert(std::sentinel_for<local_iterator, local_iterator>);
55static_assert(std::sentinel_for<local_iterator, const_local_iterator>);
56static_assert(!std::sized_sentinel_for<local_iterator, local_iterator>);
57static_assert(!std::sized_sentinel_for<local_iterator, const_local_iterator>);
58static_assert(std::indirectly_movable<local_iterator, std::pair<int, int>*>);
59static_assert(!std::indirectly_movable_storable<local_iterator, std::pair<int, int>*>);
60static_assert(std::indirectly_copyable<local_iterator, std::pair<int, int>*>);
61static_assert(!std::indirectly_copyable_storable<local_iterator, std::pair<int, int>*>);
62static_assert(!std::indirectly_swappable<local_iterator, local_iterator>);
63
64static_assert(std::forward_iterator<const_local_iterator>);
65LIBCPP_STATIC_ASSERT(!std::bidirectional_iterator<const_local_iterator>);
66static_assert(!std::indirectly_writable<const_local_iterator, value_type>);
67static_assert(std::sentinel_for<const_local_iterator, local_iterator>);
68static_assert(std::sentinel_for<const_local_iterator, const_local_iterator>);
69static_assert(!std::sized_sentinel_for<const_local_iterator, local_iterator>);
70static_assert(!std::sized_sentinel_for<const_local_iterator, const_local_iterator>);
71static_assert(std::indirectly_movable<const_local_iterator, std::pair<int, int>*>);
72static_assert(!std::indirectly_movable_storable<const_local_iterator, std::pair<int, int>*>);
73static_assert(std::indirectly_copyable<const_local_iterator, std::pair<int, int>*>);
74static_assert(!std::indirectly_copyable_storable<const_local_iterator, std::pair<int, int>*>);
75static_assert(!std::indirectly_swappable<const_local_iterator, const_local_iterator>);
76

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