1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
11 // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
12 // class Alloc = allocator<Value>>
13 // class unordered_set
15 // local_iterator begin (size_type n);
16 // local_iterator end (size_type n);
17 // const_local_iterator begin (size_type n) const;
18 // const_local_iterator end (size_type n) const;
19 // const_local_iterator cbegin(size_type n) const;
20 // const_local_iterator cend (size_type n) const;
22 #include <unordered_set>
28 typedef std::unordered_set
<int> C
;
30 typedef C::local_iterator I
;
40 C
c(a
, a
+ sizeof(a
)/sizeof(a
[0]));
41 assert(c
.bucket_count() >= 5);
42 C::size_type b
= c
.bucket(0);
45 assert(std::distance(i
, j
) == 0);
50 assert(std::distance(i
, j
) == 2);
59 assert(std::distance(i
, j
) == 2);
67 assert(std::distance(i
, j
) == 1);
73 assert(std::distance(i
, j
) == 1);
79 assert(std::distance(i
, j
) == 0);
84 assert(std::distance(i
, j
) == 0);
87 typedef std::unordered_set
<int> C
;
89 typedef C::const_local_iterator I
;
99 const C
c(a
, a
+ sizeof(a
)/sizeof(a
[0]));
100 assert(c
.bucket_count() >= 5);
101 C::size_type b
= c
.bucket(0);
104 assert(std::distance(i
, j
) == 0);
109 assert(std::distance(i
, j
) == 2);
117 assert(std::distance(i
, j
) == 2);
125 assert(std::distance(i
, j
) == 1);
131 assert(std::distance(i
, j
) == 1);
137 assert(std::distance(i
, j
) == 0);
142 assert(std::distance(i
, j
) == 0);
145 typedef std::unordered_set
<int> C
;
147 typedef C::const_local_iterator I
;
157 C
c(a
, a
+ sizeof(a
)/sizeof(a
[0]));
158 assert(c
.bucket_count() >= 5);
159 C::size_type b
= c
.bucket(0);
162 assert(std::distance(i
, j
) == 0);
167 assert(std::distance(i
, j
) == 2);
175 assert(std::distance(i
, j
) == 2);
183 assert(std::distance(i
, j
) == 1);
189 assert(std::distance(i
, j
) == 1);
195 assert(std::distance(i
, j
) == 0);
200 assert(std::distance(i
, j
) == 0);
203 typedef std::unordered_set
<int> C
;
205 typedef C::const_local_iterator I
;
215 const C
c(a
, a
+ sizeof(a
)/sizeof(a
[0]));
216 assert(c
.bucket_count() >= 5);
217 C::size_type b
= c
.bucket(0);
220 assert(std::distance(i
, j
) == 0);
225 assert(std::distance(i
, j
) == 2);
233 assert(std::distance(i
, j
) == 2);
241 assert(std::distance(i
, j
) == 1);
247 assert(std::distance(i
, j
) == 1);
253 assert(std::distance(i
, j
) == 0);
258 assert(std::distance(i
, j
) == 0);