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 Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
12 // class Alloc = allocator<pair<const Key, T>>>
13 // class unordered_multimap
15 // void swap(unordered_multimap& __u);
17 #include <unordered_map>
24 #include "test_macros.h"
25 #include "../../test_compare.h"
26 #include "../../test_hash.h"
27 #include "test_allocator.h"
29 #include "min_allocator.h"
34 typedef test_hash
<int> Hash
;
35 typedef test_equal_to
<int> Compare
;
36 typedef test_allocator
<std::pair
<const int, std::string
> > Alloc
;
37 typedef std::unordered_multimap
<int, std::string
, Hash
, Compare
, Alloc
> C
;
38 C
c1(0, Hash(1), Compare(1), Alloc(1, 1));
39 C
c2(0, Hash(2), Compare(2), Alloc(1, 2));
40 c2
.max_load_factor(2);
43 LIBCPP_ASSERT(c1
.bucket_count() == 0);
44 assert(c1
.size() == 0);
45 assert(c1
.hash_function() == Hash(2));
46 assert(c1
.key_eq() == Compare(2));
47 assert(c1
.get_allocator().get_id() == 1);
48 assert(static_cast<std::size_t>(std::distance(c1
.begin(), c1
.end())) == c1
.size());
49 assert(static_cast<std::size_t>(std::distance(c1
.cbegin(), c1
.cend())) == c1
.size());
50 assert(c1
.max_load_factor() == 2);
52 LIBCPP_ASSERT(c2
.bucket_count() == 0);
53 assert(c2
.size() == 0);
54 assert(c2
.hash_function() == Hash(1));
55 assert(c2
.key_eq() == Compare(1));
56 assert(c2
.get_allocator().get_id() == 2);
57 assert(static_cast<std::size_t>(std::distance(c2
.begin(), c2
.end())) == c2
.size());
58 assert(static_cast<std::size_t>(std::distance(c2
.cbegin(), c2
.cend())) == c2
.size());
59 assert(c2
.max_load_factor() == 1);
62 typedef test_hash
<int> Hash
;
63 typedef test_equal_to
<int> Compare
;
64 typedef test_allocator
<std::pair
<const int, std::string
> > Alloc
;
65 typedef std::unordered_multimap
<int, std::string
, Hash
, Compare
, Alloc
> C
;
66 typedef std::pair
<int, std::string
> P
;
78 C
c1(0, Hash(1), Compare(1), Alloc(1, 1));
79 C
c2(std::begin(a2
), std::end(a2
), 0, Hash(2), Compare(2), Alloc(1, 2));
80 c2
.max_load_factor(2);
83 assert(c1
.bucket_count() >= 8);
84 assert(c1
.size() == 8);
85 assert(c1
.find(10)->second
== "ten");
86 assert(c1
.find(20)->second
== "twenty");
87 assert(c1
.find(30)->second
== "thirty");
88 assert(c1
.find(40)->second
== "forty");
89 assert(c1
.find(50)->second
== "fifty");
90 assert(c1
.find(60)->second
== "sixty");
91 assert(c1
.find(70)->second
== "seventy");
92 assert(c1
.find(80)->second
== "eighty");
93 assert(c1
.hash_function() == Hash(2));
94 assert(c1
.key_eq() == Compare(2));
95 assert(c1
.get_allocator().get_id() == 1);
96 assert(static_cast<std::size_t>(std::distance(c1
.begin(), c1
.end())) == c1
.size());
97 assert(static_cast<std::size_t>(std::distance(c1
.cbegin(), c1
.cend())) == c1
.size());
98 assert(c1
.max_load_factor() == 2);
100 LIBCPP_ASSERT(c2
.bucket_count() == 0);
101 assert(c2
.size() == 0);
102 assert(c2
.hash_function() == Hash(1));
103 assert(c2
.key_eq() == Compare(1));
104 assert(c2
.get_allocator().get_id() == 2);
105 assert(static_cast<std::size_t>(std::distance(c2
.begin(), c2
.end())) == c2
.size());
106 assert(static_cast<std::size_t>(std::distance(c2
.cbegin(), c2
.cend())) == c2
.size());
107 assert(c2
.max_load_factor() == 1);
110 typedef test_hash
<int> Hash
;
111 typedef test_equal_to
<int> Compare
;
112 typedef test_allocator
<std::pair
<const int, std::string
> > Alloc
;
113 typedef std::unordered_multimap
<int, std::string
, Hash
, Compare
, Alloc
> C
;
114 typedef std::pair
<int, std::string
> P
;
124 C
c1(std::begin(a1
), std::end(a1
), 0, Hash(1), Compare(1), Alloc(1, 1));
125 C
c2(0, Hash(2), Compare(2), Alloc(1, 2));
126 c2
.max_load_factor(2);
129 LIBCPP_ASSERT(c1
.bucket_count() == 0);
130 assert(c1
.size() == 0);
131 assert(c1
.hash_function() == Hash(2));
132 assert(c1
.key_eq() == Compare(2));
133 assert(c1
.get_allocator().get_id() == 1);
134 assert(static_cast<std::size_t>(std::distance(c1
.begin(), c1
.end())) == c1
.size());
135 assert(static_cast<std::size_t>(std::distance(c1
.cbegin(), c1
.cend())) == c1
.size());
136 assert(c1
.max_load_factor() == 2);
138 assert(c2
.bucket_count() >= 6);
139 assert(c2
.size() == 6);
141 std::set
<std::string
> s
;
144 assert(s
.find(c2
.find(1)->second
) != s
.end());
145 s
.erase(s
.find(c2
.find(1)->second
));
146 assert(s
.find(std::next(c2
.find(1))->second
) != s
.end());
149 std::set
<std::string
> s
;
152 assert(s
.find(c2
.find(2)->second
) != s
.end());
153 s
.erase(s
.find(c2
.find(2)->second
));
154 assert(s
.find(std::next(c2
.find(2))->second
) != s
.end());
156 assert(c2
.find(3)->second
== "three");
157 assert(c2
.find(4)->second
== "four");
158 assert(c2
.hash_function() == Hash(1));
159 assert(c2
.key_eq() == Compare(1));
160 assert(c2
.get_allocator().get_id() == 2);
161 assert(static_cast<std::size_t>(std::distance(c2
.begin(), c2
.end())) == c2
.size());
162 assert(static_cast<std::size_t>(std::distance(c2
.cbegin(), c2
.cend())) == c2
.size());
163 assert(c2
.max_load_factor() == 1);
166 typedef test_hash
<int> Hash
;
167 typedef test_equal_to
<int> Compare
;
168 typedef test_allocator
<std::pair
<const int, std::string
> > Alloc
;
169 typedef std::unordered_multimap
<int, std::string
, Hash
, Compare
, Alloc
> C
;
170 typedef std::pair
<int, std::string
> P
;
191 C
c1(std::begin(a1
), std::end(a1
), 0, Hash(1), Compare(1), Alloc(1, 1));
192 C
c2(std::begin(a2
), std::end(a2
), 0, Hash(2), Compare(2), Alloc(1, 2));
193 c2
.max_load_factor(2);
196 assert(c1
.bucket_count() >= 8);
197 assert(c1
.size() == 8);
198 assert(c1
.find(10)->second
== "ten");
199 assert(c1
.find(20)->second
== "twenty");
200 assert(c1
.find(30)->second
== "thirty");
201 assert(c1
.find(40)->second
== "forty");
202 assert(c1
.find(50)->second
== "fifty");
203 assert(c1
.find(60)->second
== "sixty");
204 assert(c1
.find(70)->second
== "seventy");
205 assert(c1
.find(80)->second
== "eighty");
206 assert(c1
.hash_function() == Hash(2));
207 assert(c1
.key_eq() == Compare(2));
208 assert(c1
.get_allocator().get_id() == 1);
209 assert(static_cast<std::size_t>(std::distance(c1
.begin(), c1
.end())) == c1
.size());
210 assert(static_cast<std::size_t>(std::distance(c1
.cbegin(), c1
.cend())) == c1
.size());
211 assert(c1
.max_load_factor() == 2);
213 assert(c2
.bucket_count() >= 6);
214 assert(c2
.size() == 6);
216 std::set
<std::string
> s
;
219 assert(s
.find(c2
.find(1)->second
) != s
.end());
220 s
.erase(s
.find(c2
.find(1)->second
));
221 assert(s
.find(std::next(c2
.find(1))->second
) != s
.end());
224 std::set
<std::string
> s
;
227 assert(s
.find(c2
.find(2)->second
) != s
.end());
228 s
.erase(s
.find(c2
.find(2)->second
));
229 assert(s
.find(std::next(c2
.find(2))->second
) != s
.end());
231 assert(c2
.find(3)->second
== "three");
232 assert(c2
.find(4)->second
== "four");
233 assert(c2
.hash_function() == Hash(1));
234 assert(c2
.key_eq() == Compare(1));
235 assert(c2
.get_allocator().get_id() == 2);
236 assert(static_cast<std::size_t>(std::distance(c2
.begin(), c2
.end())) == c2
.size());
237 assert(static_cast<std::size_t>(std::distance(c2
.cbegin(), c2
.cend())) == c2
.size());
238 assert(c2
.max_load_factor() == 1);
242 typedef test_hash
<int> Hash
;
243 typedef test_equal_to
<int> Compare
;
244 typedef other_allocator
<std::pair
<const int, std::string
> > Alloc
;
245 typedef std::unordered_multimap
<int, std::string
, Hash
, Compare
, Alloc
> C
;
246 C
c1(0, Hash(1), Compare(1), Alloc(1));
247 C
c2(0, Hash(2), Compare(2), Alloc(2));
248 c2
.max_load_factor(2);
251 LIBCPP_ASSERT(c1
.bucket_count() == 0);
252 assert(c1
.size() == 0);
253 assert(c1
.hash_function() == Hash(2));
254 assert(c1
.key_eq() == Compare(2));
255 assert(c1
.get_allocator() == Alloc(2));
256 assert(static_cast<std::size_t>(std::distance(c1
.begin(), c1
.end())) == c1
.size());
257 assert(static_cast<std::size_t>(std::distance(c1
.cbegin(), c1
.cend())) == c1
.size());
258 assert(c1
.max_load_factor() == 2);
260 LIBCPP_ASSERT(c2
.bucket_count() == 0);
261 assert(c2
.size() == 0);
262 assert(c2
.hash_function() == Hash(1));
263 assert(c2
.key_eq() == Compare(1));
264 assert(c2
.get_allocator() == Alloc(1));
265 assert(static_cast<std::size_t>(std::distance(c2
.begin(), c2
.end())) == c2
.size());
266 assert(static_cast<std::size_t>(std::distance(c2
.cbegin(), c2
.cend())) == c2
.size());
267 assert(c2
.max_load_factor() == 1);
270 typedef test_hash
<int> Hash
;
271 typedef test_equal_to
<int> Compare
;
272 typedef other_allocator
<std::pair
<const int, std::string
> > Alloc
;
273 typedef std::unordered_multimap
<int, std::string
, Hash
, Compare
, Alloc
> C
;
274 typedef std::pair
<int, std::string
> P
;
286 C
c1(0, Hash(1), Compare(1), Alloc(1));
287 C
c2(std::begin(a2
), std::end(a2
), 0, Hash(2), Compare(2), Alloc(2));
288 c2
.max_load_factor(2);
291 assert(c1
.bucket_count() >= 8);
292 assert(c1
.size() == 8);
293 assert(c1
.find(10)->second
== "ten");
294 assert(c1
.find(20)->second
== "twenty");
295 assert(c1
.find(30)->second
== "thirty");
296 assert(c1
.find(40)->second
== "forty");
297 assert(c1
.find(50)->second
== "fifty");
298 assert(c1
.find(60)->second
== "sixty");
299 assert(c1
.find(70)->second
== "seventy");
300 assert(c1
.find(80)->second
== "eighty");
301 assert(c1
.hash_function() == Hash(2));
302 assert(c1
.key_eq() == Compare(2));
303 assert(c1
.get_allocator() == Alloc(2));
304 assert(static_cast<std::size_t>(std::distance(c1
.begin(), c1
.end())) == c1
.size());
305 assert(static_cast<std::size_t>(std::distance(c1
.cbegin(), c1
.cend())) == c1
.size());
306 assert(c1
.max_load_factor() == 2);
308 LIBCPP_ASSERT(c2
.bucket_count() == 0);
309 assert(c2
.size() == 0);
310 assert(c2
.hash_function() == Hash(1));
311 assert(c2
.key_eq() == Compare(1));
312 assert(c2
.get_allocator() == Alloc(1));
313 assert(static_cast<std::size_t>(std::distance(c2
.begin(), c2
.end())) == c2
.size());
314 assert(static_cast<std::size_t>(std::distance(c2
.cbegin(), c2
.cend())) == c2
.size());
315 assert(c2
.max_load_factor() == 1);
318 typedef test_hash
<int> Hash
;
319 typedef test_equal_to
<int> Compare
;
320 typedef other_allocator
<std::pair
<const int, std::string
> > Alloc
;
321 typedef std::unordered_multimap
<int, std::string
, Hash
, Compare
, Alloc
> C
;
322 typedef std::pair
<int, std::string
> P
;
332 C
c1(std::begin(a1
), std::end(a1
), 0, Hash(1), Compare(1), Alloc(1));
333 C
c2(0, Hash(2), Compare(2), Alloc(2));
334 c2
.max_load_factor(2);
337 LIBCPP_ASSERT(c1
.bucket_count() == 0);
338 assert(c1
.size() == 0);
339 assert(c1
.hash_function() == Hash(2));
340 assert(c1
.key_eq() == Compare(2));
341 assert(c1
.get_allocator() == Alloc(2));
342 assert(static_cast<std::size_t>(std::distance(c1
.begin(), c1
.end())) == c1
.size());
343 assert(static_cast<std::size_t>(std::distance(c1
.cbegin(), c1
.cend())) == c1
.size());
344 assert(c1
.max_load_factor() == 2);
346 assert(c2
.bucket_count() >= 6);
347 assert(c2
.size() == 6);
349 std::set
<std::string
> s
;
352 assert(s
.find(c2
.find(1)->second
) != s
.end());
353 s
.erase(s
.find(c2
.find(1)->second
));
354 assert(s
.find(std::next(c2
.find(1))->second
) != s
.end());
357 std::set
<std::string
> s
;
360 assert(s
.find(c2
.find(2)->second
) != s
.end());
361 s
.erase(s
.find(c2
.find(2)->second
));
362 assert(s
.find(std::next(c2
.find(2))->second
) != s
.end());
364 assert(c2
.find(3)->second
== "three");
365 assert(c2
.find(4)->second
== "four");
366 assert(c2
.hash_function() == Hash(1));
367 assert(c2
.key_eq() == Compare(1));
368 assert(c2
.get_allocator() == Alloc(1));
369 assert(static_cast<std::size_t>(std::distance(c2
.begin(), c2
.end())) == c2
.size());
370 assert(static_cast<std::size_t>(std::distance(c2
.cbegin(), c2
.cend())) == c2
.size());
371 assert(c2
.max_load_factor() == 1);
374 typedef test_hash
<int> Hash
;
375 typedef test_equal_to
<int> Compare
;
376 typedef other_allocator
<std::pair
<const int, std::string
> > Alloc
;
377 typedef std::unordered_multimap
<int, std::string
, Hash
, Compare
, Alloc
> C
;
378 typedef std::pair
<int, std::string
> P
;
399 C
c1(std::begin(a1
), std::end(a1
), 0, Hash(1), Compare(1), Alloc(1));
400 C
c2(std::begin(a2
), std::end(a2
), 0, Hash(2), Compare(2), Alloc(2));
401 c2
.max_load_factor(2);
404 assert(c1
.bucket_count() >= 8);
405 assert(c1
.size() == 8);
406 assert(c1
.find(10)->second
== "ten");
407 assert(c1
.find(20)->second
== "twenty");
408 assert(c1
.find(30)->second
== "thirty");
409 assert(c1
.find(40)->second
== "forty");
410 assert(c1
.find(50)->second
== "fifty");
411 assert(c1
.find(60)->second
== "sixty");
412 assert(c1
.find(70)->second
== "seventy");
413 assert(c1
.find(80)->second
== "eighty");
414 assert(c1
.hash_function() == Hash(2));
415 assert(c1
.key_eq() == Compare(2));
416 assert(c1
.get_allocator() == Alloc(2));
417 assert(static_cast<std::size_t>(std::distance(c1
.begin(), c1
.end())) == c1
.size());
418 assert(static_cast<std::size_t>(std::distance(c1
.cbegin(), c1
.cend())) == c1
.size());
419 assert(c1
.max_load_factor() == 2);
421 assert(c2
.bucket_count() >= 6);
422 assert(c2
.size() == 6);
424 std::set
<std::string
> s
;
427 assert(s
.find(c2
.find(1)->second
) != s
.end());
428 s
.erase(s
.find(c2
.find(1)->second
));
429 assert(s
.find(std::next(c2
.find(1))->second
) != s
.end());
432 std::set
<std::string
> s
;
435 assert(s
.find(c2
.find(2)->second
) != s
.end());
436 s
.erase(s
.find(c2
.find(2)->second
));
437 assert(s
.find(std::next(c2
.find(2))->second
) != s
.end());
439 assert(c2
.find(3)->second
== "three");
440 assert(c2
.find(4)->second
== "four");
441 assert(c2
.hash_function() == Hash(1));
442 assert(c2
.key_eq() == Compare(1));
443 assert(c2
.get_allocator() == Alloc(1));
444 assert(static_cast<std::size_t>(std::distance(c2
.begin(), c2
.end())) == c2
.size());
445 assert(static_cast<std::size_t>(std::distance(c2
.cbegin(), c2
.cend())) == c2
.size());
446 assert(c2
.max_load_factor() == 1);
448 #if TEST_STD_VER >= 11
450 typedef test_hash
<int> Hash
;
451 typedef test_equal_to
<int> Compare
;
452 typedef min_allocator
<std::pair
<const int, std::string
> > Alloc
;
453 typedef std::unordered_multimap
<int, std::string
, Hash
, Compare
, Alloc
> C
;
454 C
c1(0, Hash(1), Compare(1), Alloc());
455 C
c2(0, Hash(2), Compare(2), Alloc());
456 c2
.max_load_factor(2);
459 LIBCPP_ASSERT(c1
.bucket_count() == 0);
460 assert(c1
.size() == 0);
461 assert(c1
.hash_function() == Hash(2));
462 assert(c1
.key_eq() == Compare(2));
463 assert(c1
.get_allocator() == Alloc());
464 assert(static_cast<std::size_t>(std::distance(c1
.begin(), c1
.end())) == c1
.size());
465 assert(static_cast<std::size_t>(std::distance(c1
.cbegin(), c1
.cend())) == c1
.size());
466 assert(c1
.max_load_factor() == 2);
468 LIBCPP_ASSERT(c2
.bucket_count() == 0);
469 assert(c2
.size() == 0);
470 assert(c2
.hash_function() == Hash(1));
471 assert(c2
.key_eq() == Compare(1));
472 assert(c2
.get_allocator() == Alloc());
473 assert(static_cast<std::size_t>(std::distance(c2
.begin(), c2
.end())) == c2
.size());
474 assert(static_cast<std::size_t>(std::distance(c2
.cbegin(), c2
.cend())) == c2
.size());
475 assert(c2
.max_load_factor() == 1);
478 typedef test_hash
<int> Hash
;
479 typedef test_equal_to
<int> Compare
;
480 typedef min_allocator
<std::pair
<const int, std::string
> > Alloc
;
481 typedef std::unordered_multimap
<int, std::string
, Hash
, Compare
, Alloc
> C
;
482 typedef std::pair
<int, std::string
> P
;
494 C
c1(0, Hash(1), Compare(1), Alloc());
495 C
c2(std::begin(a2
), std::end(a2
), 0, Hash(2), Compare(2), Alloc());
496 c2
.max_load_factor(2);
499 assert(c1
.bucket_count() >= 8);
500 assert(c1
.size() == 8);
501 assert(c1
.find(10)->second
== "ten");
502 assert(c1
.find(20)->second
== "twenty");
503 assert(c1
.find(30)->second
== "thirty");
504 assert(c1
.find(40)->second
== "forty");
505 assert(c1
.find(50)->second
== "fifty");
506 assert(c1
.find(60)->second
== "sixty");
507 assert(c1
.find(70)->second
== "seventy");
508 assert(c1
.find(80)->second
== "eighty");
509 assert(c1
.hash_function() == Hash(2));
510 assert(c1
.key_eq() == Compare(2));
511 assert(c1
.get_allocator() == Alloc());
512 assert(static_cast<std::size_t>(std::distance(c1
.begin(), c1
.end())) == c1
.size());
513 assert(static_cast<std::size_t>(std::distance(c1
.cbegin(), c1
.cend())) == c1
.size());
514 assert(c1
.max_load_factor() == 2);
516 LIBCPP_ASSERT(c2
.bucket_count() == 0);
517 assert(c2
.size() == 0);
518 assert(c2
.hash_function() == Hash(1));
519 assert(c2
.key_eq() == Compare(1));
520 assert(c2
.get_allocator() == Alloc());
521 assert(static_cast<std::size_t>(std::distance(c2
.begin(), c2
.end())) == c2
.size());
522 assert(static_cast<std::size_t>(std::distance(c2
.cbegin(), c2
.cend())) == c2
.size());
523 assert(c2
.max_load_factor() == 1);
526 typedef test_hash
<int> Hash
;
527 typedef test_equal_to
<int> Compare
;
528 typedef min_allocator
<std::pair
<const int, std::string
> > Alloc
;
529 typedef std::unordered_multimap
<int, std::string
, Hash
, Compare
, Alloc
> C
;
530 typedef std::pair
<int, std::string
> P
;
540 C
c1(std::begin(a1
), std::end(a1
), 0, Hash(1), Compare(1), Alloc());
541 C
c2(0, Hash(2), Compare(2), Alloc());
542 c2
.max_load_factor(2);
545 LIBCPP_ASSERT(c1
.bucket_count() == 0);
546 assert(c1
.size() == 0);
547 assert(c1
.hash_function() == Hash(2));
548 assert(c1
.key_eq() == Compare(2));
549 assert(c1
.get_allocator() == Alloc());
550 assert(static_cast<std::size_t>(std::distance(c1
.begin(), c1
.end())) == c1
.size());
551 assert(static_cast<std::size_t>(std::distance(c1
.cbegin(), c1
.cend())) == c1
.size());
552 assert(c1
.max_load_factor() == 2);
554 assert(c2
.bucket_count() >= 6);
555 assert(c2
.size() == 6);
557 std::set
<std::string
> s
;
560 assert(s
.find(c2
.find(1)->second
) != s
.end());
561 s
.erase(s
.find(c2
.find(1)->second
));
562 assert(s
.find(std::next(c2
.find(1))->second
) != s
.end());
565 std::set
<std::string
> s
;
568 assert(s
.find(c2
.find(2)->second
) != s
.end());
569 s
.erase(s
.find(c2
.find(2)->second
));
570 assert(s
.find(std::next(c2
.find(2))->second
) != s
.end());
572 assert(c2
.find(3)->second
== "three");
573 assert(c2
.find(4)->second
== "four");
574 assert(c2
.hash_function() == Hash(1));
575 assert(c2
.key_eq() == Compare(1));
576 assert(c2
.get_allocator() == Alloc());
577 assert(static_cast<std::size_t>(std::distance(c2
.begin(), c2
.end())) == c2
.size());
578 assert(static_cast<std::size_t>(std::distance(c2
.cbegin(), c2
.cend())) == c2
.size());
579 assert(c2
.max_load_factor() == 1);
582 typedef test_hash
<int> Hash
;
583 typedef test_equal_to
<int> Compare
;
584 typedef min_allocator
<std::pair
<const int, std::string
> > Alloc
;
585 typedef std::unordered_multimap
<int, std::string
, Hash
, Compare
, Alloc
> C
;
586 typedef std::pair
<int, std::string
> P
;
607 C
c1(std::begin(a1
), std::end(a1
), 0, Hash(1), Compare(1), Alloc());
608 C
c2(std::begin(a2
), std::end(a2
), 0, Hash(2), Compare(2), Alloc());
609 c2
.max_load_factor(2);
612 assert(c1
.bucket_count() >= 8);
613 assert(c1
.size() == 8);
614 assert(c1
.find(10)->second
== "ten");
615 assert(c1
.find(20)->second
== "twenty");
616 assert(c1
.find(30)->second
== "thirty");
617 assert(c1
.find(40)->second
== "forty");
618 assert(c1
.find(50)->second
== "fifty");
619 assert(c1
.find(60)->second
== "sixty");
620 assert(c1
.find(70)->second
== "seventy");
621 assert(c1
.find(80)->second
== "eighty");
622 assert(c1
.hash_function() == Hash(2));
623 assert(c1
.key_eq() == Compare(2));
624 assert(c1
.get_allocator() == Alloc());
625 assert(static_cast<std::size_t>(std::distance(c1
.begin(), c1
.end())) == c1
.size());
626 assert(static_cast<std::size_t>(std::distance(c1
.cbegin(), c1
.cend())) == c1
.size());
627 assert(c1
.max_load_factor() == 2);
629 assert(c2
.bucket_count() >= 6);
630 assert(c2
.size() == 6);
632 std::set
<std::string
> s
;
635 assert(s
.find(c2
.find(1)->second
) != s
.end());
636 s
.erase(s
.find(c2
.find(1)->second
));
637 assert(s
.find(std::next(c2
.find(1))->second
) != s
.end());
640 std::set
<std::string
> s
;
643 assert(s
.find(c2
.find(2)->second
) != s
.end());
644 s
.erase(s
.find(c2
.find(2)->second
));
645 assert(s
.find(std::next(c2
.find(2))->second
) != s
.end());
647 assert(c2
.find(3)->second
== "three");
648 assert(c2
.find(4)->second
== "four");
649 assert(c2
.hash_function() == Hash(1));
650 assert(c2
.key_eq() == Compare(1));
651 assert(c2
.get_allocator() == Alloc());
652 assert(static_cast<std::size_t>(std::distance(c2
.begin(), c2
.end())) == c2
.size());
653 assert(static_cast<std::size_t>(std::distance(c2
.cbegin(), c2
.cend())) == c2
.size());
654 assert(c2
.max_load_factor() == 1);