]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/std/containers/unord/unord.multiset/unord.multiset.swap/swap_non_member.pass.cpp
Vendor import of libc++ trunk r290819:
[FreeBSD/FreeBSD.git] / test / std / containers / unord / unord.multiset / unord.multiset.swap / swap_non_member.pass.cpp
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // <unordered_set>
11
12 // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
13 //           class Alloc = allocator<Value>>
14 // class unordered_multiset
15
16 // void swap(unordered_multiset& x, unordered_multiset& y);
17
18 #include <unordered_set>
19 #include <cassert>
20 #include <cstddef>
21
22 #include "test_macros.h"
23 #include "../../../test_compare.h"
24 #include "../../../test_hash.h"
25 #include "test_allocator.h"
26 #include "min_allocator.h"
27
28 int main()
29 {
30     {
31         typedef test_hash<std::hash<int> > Hash;
32         typedef test_compare<std::equal_to<int> > Compare;
33         typedef test_allocator<int> Alloc;
34         typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
35         typedef int P;
36         C c1(0, Hash(1), Compare(1), Alloc(1, 1));
37         C c2(0, Hash(2), Compare(2), Alloc(1, 2));
38         c2.max_load_factor(2);
39         swap(c1, c2);
40
41         LIBCPP_ASSERT(c1.bucket_count() == 0);
42         assert(c1.size() == 0);
43         assert(c1.hash_function() == Hash(2));
44         assert(c1.key_eq() == Compare(2));
45         assert(c1.get_allocator().get_id() == 1);
46         assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
47         assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
48         assert(c1.max_load_factor() == 2);
49
50         LIBCPP_ASSERT(c2.bucket_count() == 0);
51         assert(c2.size() == 0);
52         assert(c2.hash_function() == Hash(1));
53         assert(c2.key_eq() == Compare(1));
54         assert(c2.get_allocator().get_id() == 2);
55         assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
56         assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
57         assert(c2.max_load_factor() == 1);
58     }
59     {
60         typedef test_hash<std::hash<int> > Hash;
61         typedef test_compare<std::equal_to<int> > Compare;
62         typedef test_allocator<int> Alloc;
63         typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
64         typedef int P;
65         P a2[] =
66         {
67             P(10),
68             P(20),
69             P(30),
70             P(40),
71             P(50),
72             P(60),
73             P(70),
74             P(80)
75         };
76         C c1(0, Hash(1), Compare(1), Alloc(1, 1));
77         C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
78         c2.max_load_factor(2);
79         swap(c1, c2);
80
81         assert(c1.bucket_count() >= 8);
82         assert(c1.size() == 8);
83         assert(*c1.find(10) == 10);
84         assert(*c1.find(20) == 20);
85         assert(*c1.find(30) == 30);
86         assert(*c1.find(40) == 40);
87         assert(*c1.find(50) == 50);
88         assert(*c1.find(60) == 60);
89         assert(*c1.find(70) == 70);
90         assert(*c1.find(80) == 80);
91         assert(c1.hash_function() == Hash(2));
92         assert(c1.key_eq() == Compare(2));
93         assert(c1.get_allocator().get_id() == 1);
94         assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
95         assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
96         assert(c1.max_load_factor() == 2);
97
98         LIBCPP_ASSERT(c2.bucket_count() == 0);
99         assert(c2.size() == 0);
100         assert(c2.hash_function() == Hash(1));
101         assert(c2.key_eq() == Compare(1));
102         assert(c2.get_allocator().get_id() == 2);
103         assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
104         assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
105         assert(c2.max_load_factor() == 1);
106     }
107     {
108         typedef test_hash<std::hash<int> > Hash;
109         typedef test_compare<std::equal_to<int> > Compare;
110         typedef test_allocator<int> Alloc;
111         typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
112         typedef int P;
113         P a1[] =
114         {
115             P(1),
116             P(2),
117             P(3),
118             P(4),
119             P(1),
120             P(2)
121         };
122         C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
123         C c2(0, Hash(2), Compare(2), Alloc(1, 2));
124         c2.max_load_factor(2);
125         swap(c1, c2);
126
127         LIBCPP_ASSERT(c1.bucket_count() == 0);
128         assert(c1.size() == 0);
129         assert(c1.hash_function() == Hash(2));
130         assert(c1.key_eq() == Compare(2));
131         assert(c1.get_allocator().get_id() == 1);
132         assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
133         assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
134         assert(c1.max_load_factor() == 2);
135
136         assert(c2.bucket_count() >= 6);
137         assert(c2.size() == 6);
138         assert(c2.count(1) == 2);
139         assert(c2.count(2) == 2);
140         assert(c2.count(3) == 1);
141         assert(c2.count(4) == 1);
142         assert(c2.hash_function() == Hash(1));
143         assert(c2.key_eq() == Compare(1));
144         assert(c2.get_allocator().get_id() == 2);
145         assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
146         assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
147         assert(c2.max_load_factor() == 1);
148     }
149     {
150         typedef test_hash<std::hash<int> > Hash;
151         typedef test_compare<std::equal_to<int> > Compare;
152         typedef test_allocator<int> Alloc;
153         typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
154         typedef int P;
155         P a1[] =
156         {
157             P(1),
158             P(2),
159             P(3),
160             P(4),
161             P(1),
162             P(2)
163         };
164         P a2[] =
165         {
166             P(10),
167             P(20),
168             P(30),
169             P(40),
170             P(50),
171             P(60),
172             P(70),
173             P(80)
174         };
175         C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1, 1));
176         C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(1, 2));
177         c2.max_load_factor(2);
178         swap(c1, c2);
179
180         assert(c1.bucket_count() >= 8);
181         assert(c1.size() == 8);
182         assert(*c1.find(10) == 10);
183         assert(*c1.find(20) == 20);
184         assert(*c1.find(30) == 30);
185         assert(*c1.find(40) == 40);
186         assert(*c1.find(50) == 50);
187         assert(*c1.find(60) == 60);
188         assert(*c1.find(70) == 70);
189         assert(*c1.find(80) == 80);
190         assert(c1.hash_function() == Hash(2));
191         assert(c1.key_eq() == Compare(2));
192         assert(c1.get_allocator().get_id() == 1);
193         assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
194         assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
195         assert(c1.max_load_factor() == 2);
196
197         assert(c2.bucket_count() >= 6);
198         assert(c2.size() == 6);
199         assert(c2.count(1) == 2);
200         assert(c2.count(2) == 2);
201         assert(c2.count(3) == 1);
202         assert(c2.count(4) == 1);
203         assert(c2.hash_function() == Hash(1));
204         assert(c2.key_eq() == Compare(1));
205         assert(c2.get_allocator().get_id() == 2);
206         assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
207         assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
208         assert(c2.max_load_factor() == 1);
209     }
210
211     {
212         typedef test_hash<std::hash<int> > Hash;
213         typedef test_compare<std::equal_to<int> > Compare;
214         typedef other_allocator<int> Alloc;
215         typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
216         typedef int P;
217         C c1(0, Hash(1), Compare(1), Alloc(1));
218         C c2(0, Hash(2), Compare(2), Alloc(2));
219         c2.max_load_factor(2);
220         swap(c1, c2);
221
222         LIBCPP_ASSERT(c1.bucket_count() == 0);
223         assert(c1.size() == 0);
224         assert(c1.hash_function() == Hash(2));
225         assert(c1.key_eq() == Compare(2));
226         assert(c1.get_allocator() == Alloc(2));
227         assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
228         assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
229         assert(c1.max_load_factor() == 2);
230
231         LIBCPP_ASSERT(c2.bucket_count() == 0);
232         assert(c2.size() == 0);
233         assert(c2.hash_function() == Hash(1));
234         assert(c2.key_eq() == Compare(1));
235         assert(c2.get_allocator() == Alloc(1));
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);
239     }
240     {
241         typedef test_hash<std::hash<int> > Hash;
242         typedef test_compare<std::equal_to<int> > Compare;
243         typedef other_allocator<int> Alloc;
244         typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
245         typedef int P;
246         P a2[] =
247         {
248             P(10),
249             P(20),
250             P(30),
251             P(40),
252             P(50),
253             P(60),
254             P(70),
255             P(80)
256         };
257         C c1(0, Hash(1), Compare(1), Alloc(1));
258         C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
259         c2.max_load_factor(2);
260         swap(c1, c2);
261
262         assert(c1.bucket_count() >= 8);
263         assert(c1.size() == 8);
264         assert(*c1.find(10) == 10);
265         assert(*c1.find(20) == 20);
266         assert(*c1.find(30) == 30);
267         assert(*c1.find(40) == 40);
268         assert(*c1.find(50) == 50);
269         assert(*c1.find(60) == 60);
270         assert(*c1.find(70) == 70);
271         assert(*c1.find(80) == 80);
272         assert(c1.hash_function() == Hash(2));
273         assert(c1.key_eq() == Compare(2));
274         assert(c1.get_allocator() == Alloc(2));
275         assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
276         assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
277         assert(c1.max_load_factor() == 2);
278
279         LIBCPP_ASSERT(c2.bucket_count() == 0);
280         assert(c2.size() == 0);
281         assert(c2.hash_function() == Hash(1));
282         assert(c2.key_eq() == Compare(1));
283         assert(c2.get_allocator() == Alloc(1));
284         assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
285         assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
286         assert(c2.max_load_factor() == 1);
287     }
288     {
289         typedef test_hash<std::hash<int> > Hash;
290         typedef test_compare<std::equal_to<int> > Compare;
291         typedef other_allocator<int> Alloc;
292         typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
293         typedef int P;
294         P a1[] =
295         {
296             P(1),
297             P(2),
298             P(3),
299             P(4),
300             P(1),
301             P(2)
302         };
303         C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
304         C c2(0, Hash(2), Compare(2), Alloc(2));
305         c2.max_load_factor(2);
306         swap(c1, c2);
307
308         LIBCPP_ASSERT(c1.bucket_count() == 0);
309         assert(c1.size() == 0);
310         assert(c1.hash_function() == Hash(2));
311         assert(c1.key_eq() == Compare(2));
312         assert(c1.get_allocator() == Alloc(2));
313         assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
314         assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
315         assert(c1.max_load_factor() == 2);
316
317         assert(c2.bucket_count() >= 6);
318         assert(c2.size() == 6);
319         assert(c2.count(1) == 2);
320         assert(c2.count(2) == 2);
321         assert(c2.count(3) == 1);
322         assert(c2.count(4) == 1);
323         assert(c2.hash_function() == Hash(1));
324         assert(c2.key_eq() == Compare(1));
325         assert(c2.get_allocator() == Alloc(1));
326         assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
327         assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
328         assert(c2.max_load_factor() == 1);
329     }
330     {
331         typedef test_hash<std::hash<int> > Hash;
332         typedef test_compare<std::equal_to<int> > Compare;
333         typedef other_allocator<int> Alloc;
334         typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
335         typedef int P;
336         P a1[] =
337         {
338             P(1),
339             P(2),
340             P(3),
341             P(4),
342             P(1),
343             P(2)
344         };
345         P a2[] =
346         {
347             P(10),
348             P(20),
349             P(30),
350             P(40),
351             P(50),
352             P(60),
353             P(70),
354             P(80)
355         };
356         C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc(1));
357         C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc(2));
358         c2.max_load_factor(2);
359         swap(c1, c2);
360
361         assert(c1.bucket_count() >= 8);
362         assert(c1.size() == 8);
363         assert(*c1.find(10) == 10);
364         assert(*c1.find(20) == 20);
365         assert(*c1.find(30) == 30);
366         assert(*c1.find(40) == 40);
367         assert(*c1.find(50) == 50);
368         assert(*c1.find(60) == 60);
369         assert(*c1.find(70) == 70);
370         assert(*c1.find(80) == 80);
371         assert(c1.hash_function() == Hash(2));
372         assert(c1.key_eq() == Compare(2));
373         assert(c1.get_allocator() == Alloc(2));
374         assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
375         assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
376         assert(c1.max_load_factor() == 2);
377
378         assert(c2.bucket_count() >= 6);
379         assert(c2.size() == 6);
380         assert(c2.count(1) == 2);
381         assert(c2.count(2) == 2);
382         assert(c2.count(3) == 1);
383         assert(c2.count(4) == 1);
384         assert(c2.hash_function() == Hash(1));
385         assert(c2.key_eq() == Compare(1));
386         assert(c2.get_allocator() == Alloc(1));
387         assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
388         assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
389         assert(c2.max_load_factor() == 1);
390     }
391 #if TEST_STD_VER >= 11
392     {
393         typedef test_hash<std::hash<int> > Hash;
394         typedef test_compare<std::equal_to<int> > Compare;
395         typedef min_allocator<int> Alloc;
396         typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
397         typedef int P;
398         C c1(0, Hash(1), Compare(1), Alloc());
399         C c2(0, Hash(2), Compare(2), Alloc());
400         c2.max_load_factor(2);
401         swap(c1, c2);
402
403         LIBCPP_ASSERT(c1.bucket_count() == 0);
404         assert(c1.size() == 0);
405         assert(c1.hash_function() == Hash(2));
406         assert(c1.key_eq() == Compare(2));
407         assert(c1.get_allocator() == Alloc());
408         assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
409         assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
410         assert(c1.max_load_factor() == 2);
411
412         LIBCPP_ASSERT(c2.bucket_count() == 0);
413         assert(c2.size() == 0);
414         assert(c2.hash_function() == Hash(1));
415         assert(c2.key_eq() == Compare(1));
416         assert(c2.get_allocator() == Alloc());
417         assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
418         assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
419         assert(c2.max_load_factor() == 1);
420     }
421     {
422         typedef test_hash<std::hash<int> > Hash;
423         typedef test_compare<std::equal_to<int> > Compare;
424         typedef min_allocator<int> Alloc;
425         typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
426         typedef int P;
427         P a2[] =
428         {
429             P(10),
430             P(20),
431             P(30),
432             P(40),
433             P(50),
434             P(60),
435             P(70),
436             P(80)
437         };
438         C c1(0, Hash(1), Compare(1), Alloc());
439         C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
440         c2.max_load_factor(2);
441         swap(c1, c2);
442
443         assert(c1.bucket_count() >= 8);
444         assert(c1.size() == 8);
445         assert(*c1.find(10) == 10);
446         assert(*c1.find(20) == 20);
447         assert(*c1.find(30) == 30);
448         assert(*c1.find(40) == 40);
449         assert(*c1.find(50) == 50);
450         assert(*c1.find(60) == 60);
451         assert(*c1.find(70) == 70);
452         assert(*c1.find(80) == 80);
453         assert(c1.hash_function() == Hash(2));
454         assert(c1.key_eq() == Compare(2));
455         assert(c1.get_allocator() == Alloc());
456         assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
457         assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
458         assert(c1.max_load_factor() == 2);
459
460         LIBCPP_ASSERT(c2.bucket_count() == 0);
461         assert(c2.size() == 0);
462         assert(c2.hash_function() == Hash(1));
463         assert(c2.key_eq() == Compare(1));
464         assert(c2.get_allocator() == Alloc());
465         assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
466         assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
467         assert(c2.max_load_factor() == 1);
468     }
469     {
470         typedef test_hash<std::hash<int> > Hash;
471         typedef test_compare<std::equal_to<int> > Compare;
472         typedef min_allocator<int> Alloc;
473         typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
474         typedef int P;
475         P a1[] =
476         {
477             P(1),
478             P(2),
479             P(3),
480             P(4),
481             P(1),
482             P(2)
483         };
484         C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
485         C c2(0, Hash(2), Compare(2), Alloc());
486         c2.max_load_factor(2);
487         swap(c1, c2);
488
489         LIBCPP_ASSERT(c1.bucket_count() == 0);
490         assert(c1.size() == 0);
491         assert(c1.hash_function() == Hash(2));
492         assert(c1.key_eq() == Compare(2));
493         assert(c1.get_allocator() == Alloc());
494         assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
495         assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
496         assert(c1.max_load_factor() == 2);
497
498         assert(c2.bucket_count() >= 6);
499         assert(c2.size() == 6);
500         assert(c2.count(1) == 2);
501         assert(c2.count(2) == 2);
502         assert(c2.count(3) == 1);
503         assert(c2.count(4) == 1);
504         assert(c2.hash_function() == Hash(1));
505         assert(c2.key_eq() == Compare(1));
506         assert(c2.get_allocator() == Alloc());
507         assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
508         assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
509         assert(c2.max_load_factor() == 1);
510     }
511     {
512         typedef test_hash<std::hash<int> > Hash;
513         typedef test_compare<std::equal_to<int> > Compare;
514         typedef min_allocator<int> Alloc;
515         typedef std::unordered_multiset<int, Hash, Compare, Alloc> C;
516         typedef int P;
517         P a1[] =
518         {
519             P(1),
520             P(2),
521             P(3),
522             P(4),
523             P(1),
524             P(2)
525         };
526         P a2[] =
527         {
528             P(10),
529             P(20),
530             P(30),
531             P(40),
532             P(50),
533             P(60),
534             P(70),
535             P(80)
536         };
537         C c1(std::begin(a1), std::end(a1), 0, Hash(1), Compare(1), Alloc());
538         C c2(std::begin(a2), std::end(a2), 0, Hash(2), Compare(2), Alloc());
539         c2.max_load_factor(2);
540         swap(c1, c2);
541
542         assert(c1.bucket_count() >= 8);
543         assert(c1.size() == 8);
544         assert(*c1.find(10) == 10);
545         assert(*c1.find(20) == 20);
546         assert(*c1.find(30) == 30);
547         assert(*c1.find(40) == 40);
548         assert(*c1.find(50) == 50);
549         assert(*c1.find(60) == 60);
550         assert(*c1.find(70) == 70);
551         assert(*c1.find(80) == 80);
552         assert(c1.hash_function() == Hash(2));
553         assert(c1.key_eq() == Compare(2));
554         assert(c1.get_allocator() == Alloc());
555         assert(static_cast<std::size_t>(std::distance(c1.begin(), c1.end())) == c1.size());
556         assert(static_cast<std::size_t>(std::distance(c1.cbegin(), c1.cend())) == c1.size());
557         assert(c1.max_load_factor() == 2);
558
559         assert(c2.bucket_count() >= 6);
560         assert(c2.size() == 6);
561         assert(c2.count(1) == 2);
562         assert(c2.count(2) == 2);
563         assert(c2.count(3) == 1);
564         assert(c2.count(4) == 1);
565         assert(c2.hash_function() == Hash(1));
566         assert(c2.key_eq() == Compare(1));
567         assert(c2.get_allocator() == Alloc());
568         assert(static_cast<std::size_t>(std::distance(c2.begin(), c2.end())) == c2.size());
569         assert(static_cast<std::size_t>(std::distance(c2.cbegin(), c2.cend())) == c2.size());
570         assert(c2.max_load_factor() == 1);
571     }
572 #endif
573 }