boost_unordered 0.1.0

Boost C++ library boost_unordered packaged using Zanbil
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
[#unordered_multimap]
== Class Template unordered_multimap

:idprefix: unordered_multimap_

`boost::unordered_multimap` — An unordered associative container that associates keys with another value. The same key can be stored multiple times.

=== Synopsis

[listing,subs="+macros,+quotes"]
-----
// #include xref:reference/header_unordered_map.adoc[<boost/unordered/unordered_map.hpp>]

namespace boost {
namespace unordered {

  template<class Key,
           class T,
           class Hash = boost::hash<Key>,
           class Pred = std::equal_to<Key>,
           class Allocator = std::allocator<std::pair<const Key, T>>>
  class unordered_multimap {
  public:
    // types
    using key_type             = Key;
    using mapped_type          = T;
    using value_type           = std::pair<const Key, T>;
    using hasher               = Hash;
    using key_equal            = Pred;
    using allocator_type       = Allocator;
    using pointer              = typename std::allocator_traits<Allocator>::pointer;
    using const_pointer        = typename std::allocator_traits<Allocator>::const_pointer;
    using reference            = value_type&;
    using const_reference      = const value_type&;
    using size_type            = std::size_t;
    using difference_type      = std::ptrdiff_t;

    using iterator             = _implementation-defined_;
    using const_iterator       = _implementation-defined_;
    using local_iterator       = _implementation-defined_;
    using const_local_iterator = _implementation-defined_;
    using node_type            = _implementation-defined_;

    // construct/copy/destroy
    xref:#unordered_multimap_default_constructor[unordered_multimap]();
    explicit xref:#unordered_multimap_bucket_count_constructor[unordered_multimap](size_type n,
                                const hasher& hf = hasher(),
                                const key_equal& eql = key_equal(),
                                const allocator_type& a = allocator_type());
    template<class InputIterator>
      xref:#unordered_multimap_iterator_range_constructor[unordered_multimap](InputIterator f, InputIterator l,
                         size_type n = _implementation-defined_,
                         const hasher& hf = hasher(),
                         const key_equal& eql = key_equal(),
                         const allocator_type& a = allocator_type());
    xref:#unordered_multimap_copy_constructor[unordered_multimap](const unordered_multimap& other);
    xref:#unordered_multimap_move_constructor[unordered_multimap](unordered_multimap&& other);
    template<class InputIterator>
      xref:#unordered_multimap_iterator_range_constructor_with_allocator[unordered_multimap](InputIterator f, InputIterator l, const allocator_type& a);
    explicit xref:#unordered_multimap_allocator_constructor[unordered_multimap](const Allocator& a);
    xref:#unordered_multimap_copy_constructor_with_allocator[unordered_multimap](const unordered_multimap& other, const Allocator& a);
    xref:#unordered_multimap_move_constructor_with_allocator[unordered_multimap](unordered_multimap&& other, const Allocator& a);
    xref:#unordered_multimap_initializer_list_constructor[unordered_multimap](std::initializer_list<value_type> il,
                       size_type n = _implementation-defined_,
                       const hasher& hf = hasher(),
                       const key_equal& eql = key_equal(),
                       const allocator_type& a = allocator_type());
    xref:#unordered_multimap_bucket_count_constructor_with_allocator[unordered_multimap](size_type n, const allocator_type& a);
    xref:#unordered_multimap_bucket_count_constructor_with_hasher_and_allocator[unordered_multimap](size_type n, const hasher& hf, const allocator_type& a);
    template<class InputIterator>
      xref:#unordered_multimap_iterator_range_constructor_with_bucket_count_and_allocator[unordered_multimap](InputIterator f, InputIterator l, size_type n, const allocator_type& a);
    template<class InputIterator>
      xref:#unordered_multimap_iterator_range_constructor_with_bucket_count_and_hasher[unordered_multimap](InputIterator f, InputIterator l, size_type n, const hasher& hf,
                         const allocator_type& a);
    xref:#unordered_multimap_initializer_list_constructor_with_allocator[unordered_multimap](std::initializer_list<value_type> il, const allocator_type& a);
    xref:#unordered_multimap_initializer_list_constructor_with_bucket_count_and_allocator[unordered_multimap](std::initializer_list<value_type> il, size_type n,
                       const allocator_type& a);
    xref:#unordered_multimap_initializer_list_constructor_with_bucket_count_and_hasher_and_allocator[unordered_multimap](std::initializer_list<value_type> il, size_type n, const hasher& hf,
                       const allocator_type& a);
    xref:#unordered_multimap_destructor[~unordered_multimap]();
    unordered_multimap& xref:#unordered_multimap_copy_assignment[operator++=++](const unordered_multimap& other);
    unordered_multimap& xref:#unordered_multimap_move_assignment[operator++=++](unordered_multimap&& other)
      noexcept(boost::allocator_traits<Allocator>::is_always_equal::value &&
               boost::is_nothrow_move_assignable_v<Hash> &&
               boost::is_nothrow_move_assignable_v<Pred>);
    unordered_multimap& xref:#unordered_multimap_initializer_list_assignment[operator++=++](std::initializer_list<value_type> il);
    allocator_type xref:#unordered_multimap_get_allocator[get_allocator]() const noexcept;

    // iterators
    iterator       xref:#unordered_multimap_begin[begin]() noexcept;
    const_iterator xref:#unordered_multimap_begin[begin]() const noexcept;
    iterator       xref:#unordered_multimap_end[end]() noexcept;
    const_iterator xref:#unordered_multimap_end[end]() const noexcept;
    const_iterator xref:#unordered_multimap_cbegin[cbegin]() const noexcept;
    const_iterator xref:#unordered_multimap_cend[cend]() const noexcept;

    // capacity
    ++[[nodiscard]]++ bool xref:#unordered_multimap_empty[empty]() const noexcept;
    size_type xref:#unordered_multimap_size[size]() const noexcept;
    size_type xref:#unordered_multimap_max_size[max_size]() const noexcept;

    // modifiers
    template<class... Args> iterator xref:#unordered_multimap_emplace[emplace](Args&&... args);
    template<class... Args> iterator xref:#unordered_multimap_emplace_hint[emplace_hint](const_iterator position, Args&&... args);
    iterator xref:#unordered_multimap_copy_insert[insert](const value_type& obj);
    iterator xref:#unordered_multimap_move_insert[insert](value_type&& obj);
    template<class P> iterator xref:#unordered_multimap_emplace_insert[insert](P&& obj);
    iterator xref:#unordered_multimap_copy_insert_with_hint[insert](const_iterator hint, const value_type& obj);
    iterator xref:#unordered_multimap_move_insert_with_hint[insert](const_iterator hint, value_type&& obj);
    template<class P> iterator xref:#unordered_multimap_emplace_insert_with_hint[insert](const_iterator hint, P&& obj);
    template<class InputIterator> void xref:#unordered_multimap_insert_iterator_range[insert](InputIterator first, InputIterator last);
    void xref:#unordered_multimap_insert_initializer_list[insert](std::initializer_list<value_type> il);

    node_type xref:#unordered_multimap_extract_by_iterator[extract](const_iterator position);
    node_type xref:#unordered_multimap_extract_by_key[extract](const key_type& k);
    template<class K> node_type xref:#unordered_multimap_extract_by_key[extract](K&& k);
    iterator xref:#unordered_multimap_insert_with_node_handle[insert](node_type&& nh);
    iterator xref:#unordered_multimap_insert_with_hint_and_node_handle[insert](const_iterator hint, node_type&& nh);

    iterator  xref:#unordered_multimap_erase_by_position[erase](iterator position);
    iterator  xref:#unordered_multimap_erase_by_position[erase](const_iterator position);
    size_type xref:#unordered_multimap_erase_by_key[erase](const key_type& k);
    template<class K> size_type xref:#unordered_multimap_erase_by_key[erase](K&& k);
    iterator  xref:#unordered_multimap_erase_range[erase](const_iterator first, const_iterator last);
    void      xref:#unordered_multimap_quick_erase[quick_erase](const_iterator position);
    void      xref:#unordered_multimap_erase_return_void[erase_return_void](const_iterator position);
    void      xref:#unordered_multimap_swap[swap](unordered_multimap& other)
      noexcept(boost::allocator_traits<Allocator>::is_always_equal::value &&
               boost::is_nothrow_swappable_v<Hash> &&
               boost::is_nothrow_swappable_v<Pred>);
    void      xref:#unordered_multimap_clear[clear]() noexcept;

    template<class H2, class P2>
      void xref:#unordered_multimap_merge[merge](unordered_multimap<Key, T, H2, P2, Allocator>& source);
    template<class H2, class P2>
      void xref:#unordered_multimap_merge[merge](unordered_multimap<Key, T, H2, P2, Allocator>&& source);
    template<class H2, class P2>
      void xref:#unordered_multimap_merge[merge](unordered_map<Key, T, H2, P2, Allocator>& source);
    template<class H2, class P2>
      void xref:#unordered_multimap_merge[merge](unordered_map<Key, T, H2, P2, Allocator>&& source);

    // observers
    hasher xref:#unordered_multimap_hash_function[hash_function]() const;
    key_equal xref:#unordered_multimap_key_eq[key_eq]() const;

    // map operations
    iterator         xref:#unordered_multimap_find[find](const key_type& k);
    const_iterator   xref:#unordered_multimap_find[find](const key_type& k) const;
    template<class K>
      iterator       xref:#unordered_multimap_find[find](const K& k);
    template<class K>
      const_iterator xref:#unordered_multimap_find[find](const K& k) const;
    template<typename CompatibleKey, typename CompatibleHash, typename CompatiblePredicate>
      iterator       xref:#unordered_multimap_find[find](CompatibleKey const& k, CompatibleHash const& hash,
                          CompatiblePredicate const& eq);
    template<typename CompatibleKey, typename CompatibleHash, typename CompatiblePredicate>
      const_iterator xref:#unordered_multimap_find[find](CompatibleKey const& k, CompatibleHash const& hash,
                          CompatiblePredicate const& eq) const;
    size_type        xref:#unordered_multimap_count[count](const key_type& k) const;
    template<class K>
      size_type      xref:#unordered_multimap_count[count](const K& k) const;
    bool             xref:#unordered_multimap_contains[contains](const key_type& k) const;
    template<class K>
      bool           xref:#unordered_multimap_contains[contains](const K& k) const;
    std::pair<iterator, iterator>               xref:#unordered_multimap_equal_range[equal_range](const key_type& k);
    std::pair<const_iterator, const_iterator>   xref:#unordered_multimap_equal_range[equal_range](const key_type& k) const;
    template<class K>
      std::pair<iterator, iterator>             xref:#unordered_multimap_equal_range[equal_range](const K& k);
    template<class K>
      std::pair<const_iterator, const_iterator> xref:#unordered_multimap_equal_range[equal_range](const K& k) const;

    // bucket interface
    size_type xref:#unordered_multimap_bucket_count[bucket_count]() const noexcept;
    size_type xref:#unordered_multimap_max_bucket_count[max_bucket_count]() const noexcept;
    size_type xref:#unordered_multimap_bucket_size[bucket_size](size_type n) const;
    size_type xref:#unordered_multimap_bucket[bucket](const key_type& k) const;
    template<class K> size_type xref:#unordered_multimap_bucket[bucket](const K& k) const;
    local_iterator xref:#unordered_multimap_begin_2[begin](size_type n);
    const_local_iterator xref:#unordered_multimap_begin_2[begin](size_type n) const;
    local_iterator xref:#unordered_multimap_end_2[end](size_type n);
    const_local_iterator xref:#unordered_multimap_end_2[end](size_type n) const;
    const_local_iterator xref:#unordered_multimap_cbegin_2[cbegin](size_type n) const;
    const_local_iterator xref:#unordered_multimap_cend_2[cend](size_type n) const;

    // hash policy
    float xref:#unordered_multimap_load_factor[load_factor]() const noexcept;
    float xref:#unordered_multimap_max_load_factor[max_load_factor]() const noexcept;
    void xref:#unordered_multimap_max_load_factor[max_load_factor](float z);
    void xref:#unordered_multimap_rehash[rehash](size_type n);
    void xref:#unordered_multimap_reserve[reserve](size_type n);
  };

  // Deduction Guides
  template<class InputIterator,
           class Hash = boost::hash<xref:#unordered_multimap_iter_key_type[__iter-key-type__]<InputIterator>>,
           class Pred = std::equal_to<xref:#unordered_multimap_iter_key_type[__iter-key-type__]<InputIterator>>,
           class Allocator = std::allocator<xref:#unordered_multimap_iter_to_alloc_type[__iter-to-alloc-type__]<InputIterator>>>
    unordered_multimap(InputIterator, InputIterator, typename xref:#unordered_multimap_deduction_guides[__see below__]::size_type = xref:#unordered_multimap_deduction_guides[__see below__],
                       Hash = Hash(), Pred = Pred(), Allocator = Allocator())
      -> unordered_multimap<xref:#unordered_multimap_iter_key_type[__iter-key-type__]<InputIterator>, xref:#unordered_multimap_iter_mapped_type[__iter-mapped-type__]<InputIterator>, Hash,
                            Pred, Allocator>;

  template<class Key, class T, class Hash = boost::hash<Key>,
           class Pred = std::equal_to<Key>,
           class Allocator = std::allocator<std::pair<const Key, T>>>
    unordered_multimap(std::initializer_list<std::pair<Key, T>>,
                       typename xref:#unordered_multimap_deduction_guides[__see below__]::size_type = xref:#unordered_multimap_deduction_guides[__see below__], Hash = Hash(),
                       Pred = Pred(), Allocator = Allocator())
      -> unordered_multimap<Key, T, Hash, Pred, Allocator>;

  template<class InputIterator, class Allocator>
    unordered_multimap(InputIterator, InputIterator, typename xref:#unordered_multimap_deduction_guides[__see below__]::size_type, Allocator)
      -> unordered_multimap<xref:#unordered_multimap_iter_key_type[__iter-key-type__]<InputIterator>, xref:#unordered_multimap_iter_mapped_type[__iter-mapped-type__]<InputIterator>,
                            boost::hash<xref:#unordered_multimap_iter_key_type[__iter-key-type__]<InputIterator>>,
                            std::equal_to<xref:#unordered_multimap_iter_key_type[__iter-key-type__]<InputIterator>>, Allocator>;

  template<class InputIterator, class Allocator>
    unordered_multimap(InputIterator, InputIterator, Allocator)
      -> unordered_multimap<xref:#unordered_multimap_iter_key_type[__iter-key-type__]<InputIterator>, xref:#unordered_multimap_iter_mapped_type[__iter-mapped-type__]<InputIterator>,
                            boost::hash<xref:#unordered_multimap_iter_key_type[__iter-key-type__]<InputIterator>>,
                            std::equal_to<xref:#unordered_multimap_iter_key_type[__iter-key-type__]<InputIterator>>, Allocator>;

  template<class InputIterator, class Hash, class Allocator>
    unordered_multimap(InputIterator, InputIterator, typename xref:#unordered_multimap_deduction_guides[__see below__]::size_type, Hash,
                       Allocator)
      -> unordered_multimap<xref:#unordered_multimap_iter_key_type[__iter-key-type__]<InputIterator>, xref:#unordered_multimap_iter_mapped_type[__iter-mapped-type__]<InputIterator>, Hash,
                            std::equal_to<xref:#unordered_multimap_iter_key_type[__iter-key-type__]<InputIterator>>, Allocator>;

  template<class Key, class T, class Allocator>
    unordered_multimap(std::initializer_list<std::pair<Key, T>>, typename xref:#unordered_multimap_deduction_guides[__see below__]::size_type,
                       Allocator)
      -> unordered_multimap<Key, T, boost::hash<Key>, std::equal_to<Key>, Allocator>;

  template<class Key, class T, class Allocator>
    unordered_multimap(std::initializer_list<std::pair<Key, T>>, Allocator)
      -> unordered_multimap<Key, T, boost::hash<Key>, std::equal_to<Key>, Allocator>;

  template<class Key, class T, class Hash, class Allocator>
    unordered_multimap(std::initializer_list<std::pair<Key, T>>, typename xref:#unordered_multimap_deduction_guides[__see below__]::size_type,
                       Hash, Allocator)
      -> unordered_multimap<Key, T, Hash, std::equal_to<Key>, Allocator>;

} // namespace unordered
} // namespace boost
-----

---

=== Description

*Template Parameters*

[cols="1,1"]
|===

|_Key_
|`Key` must be https://en.cppreference.com/w/cpp/named_req/Erasable[Erasable^] from the container (i.e. `allocator_traits` can destroy it).

|_T_
|`T` must be https://en.cppreference.com/w/cpp/named_req/Erasable[Erasable^] from the container (i.e. `allocator_traits` can destroy it).

|_Hash_
|A unary function object type that acts a hash function for a `Key`. It takes a single argument of type `Key` and returns a value of type `std::size_t`.

|_Pred_
|A binary function object that implements an equivalence relation on values of type `Key`. A binary function object that induces an equivalence relation on values of type `Key`. It takes two arguments of type `Key` and returns a value of type bool.

|_Allocator_
|An allocator whose value type is the same as the container's value type.
Allocators using https://en.cppreference.com/w/cpp/named_req/Allocator#Fancy_pointers[fancy pointers] are supported.

|===

The elements are organized into buckets. Keys with the same hash code are stored in the same bucket.

The number of buckets can be automatically increased by a call to insert, or as the result of calling rehash.

=== Configuration macros

==== `BOOST_UNORDERED_ENABLE_SERIALIZATION_COMPATIBILITY_V0`

Globally define this macro to support loading of ``unordered_multimap``s saved to
a Boost.Serialization archive with a version of Boost prior to Boost 1.84.

=== Typedefs

[source,c++,subs=+quotes]
----
typedef _implementation-defined_ iterator;
----

An iterator whose value type is `value_type`.

The iterator category is at least a forward iterator.

Convertible to `const_iterator`.

---

[source,c++,subs=+quotes]
----
typedef _implementation-defined_ const_iterator;
----

A constant iterator whose value type is `value_type`.

The iterator category is at least a forward iterator.

---

[source,c++,subs=+quotes]
----
typedef _implementation-defined_ local_iterator;
----

An iterator with the same value type, difference type and pointer and reference type as iterator.

A `local_iterator` object can be used to iterate through a single bucket.

---

[source,c++,subs=+quotes]
----
typedef _implementation-defined_ const_local_iterator;
----

A constant iterator with the same value type, difference type and pointer and reference type as const_iterator.

A const_local_iterator object can be used to iterate through a single bucket.

---

[source,c++,subs=+quotes]
----
typedef _implementation-defined_ node_type;
----

See node_handle_map for details.

---

=== Constructors

==== Default Constructor
```c++
unordered_multimap();
```

Constructs an empty container using `hasher()` as the hash function,
`key_equal()` as the key equality predicate, `allocator_type()` as the allocator
and a maximum load factor of `1.0`.

[horizontal]
Postconditions:;; `size() == 0`
Requires:;; If the defaults are used, `hasher`, `key_equal` and `allocator_type` need to be https://en.cppreference.com/w/cpp/named_req/DefaultConstructible[DefaultConstructible^].

---

==== Bucket Count Constructor
```c++
explicit unordered_multimap(size_type n,
                            const hasher& hf = hasher(),
                            const key_equal& eql = key_equal(),
                            const allocator_type& a = allocator_type());
```

Constructs an empty container with at least `n` buckets, using `hf` as the hash
function, `eql` as the key equality predicate, `a` as the allocator and a maximum
load factor of `1.0`.

[horizontal]
Postconditions:;; `size() == 0`
Requires:;; If the defaults are used, `hasher`, `key_equal` and `allocator_type` need to be https://en.cppreference.com/w/cpp/named_req/DefaultConstructible[DefaultConstructible^].

---

==== Iterator Range Constructor
[source,c++,subs="+quotes"]
----
template<class InputIterator>
unordered_multimap(InputIterator f, InputIterator l,
                   size_type n = _implementation-defined_,
                   const hasher& hf = hasher(),
                   const key_equal& eql = key_equal(),
                   const allocator_type& a = allocator_type());
----

Constructs an empty container with at least `n` buckets, using `hf` as the hash function, `eql` as the key equality predicate, `a` as the allocator and a maximum load factor of `1.0` and inserts the elements from `[f, l)` into it.

[horizontal]
Requires:;; If the defaults are used, `hasher`, `key_equal` and `allocator_type` need to be https://en.cppreference.com/w/cpp/named_req/DefaultConstructible[DefaultConstructible^].

---

==== Copy Constructor
```c++
unordered_multimap(const unordered_multimap& other);
```

The copy constructor. Copies the contained elements, hash function, predicate, maximum load factor and allocator.

If `Allocator::select_on_container_copy_construction` exists and has the right signature, the allocator will be constructed from its result.

[horizontal]
Requires:;; `value_type` is copy constructible

---

==== Move Constructor
```c++
unordered_multimap(unordered_multimap&& other);
```

The move constructor.

[horizontal]
Notes:;; This is implemented using Boost.Move.
Requires:;; `value_type` is move-constructible.

---

==== Iterator Range Constructor with Allocator
```c++
template<class InputIterator>
  unordered_multimap(InputIterator f, InputIterator l, const allocator_type& a);
```

Constructs an empty container using `a` as the allocator, with the default hash function and key equality predicate and a maximum load factor of `1.0` and inserts the elements from `[f, l)` into it.

[horizontal]
Requires:;; `hasher`, `key_equal` need to be https://en.cppreference.com/w/cpp/named_req/DefaultConstructible[DefaultConstructible^].

---

==== Allocator Constructor
```c++
explicit unordered_multimap(const Allocator& a);
```

Constructs an empty container, using allocator `a`.

---

==== Copy Constructor with Allocator
```c++
unordered_multimap(const unordered_multimap& other, const Allocator& a);
```

Constructs an container, copying ``other``'s contained elements, hash function, predicate, maximum load factor, but using allocator `a`.

---

==== Move Constructor with Allocator
```c++
unordered_multimap(unordered_multimap&& other, const Allocator& a);
```

Construct a container moving ``other``'s contained elements, and having the hash function, predicate and maximum load factor, but using allocate `a`.

[horizontal]
Notes:;; This is implemented using Boost.Move.
Requires:;; `value_type` is move insertable.

---

==== Initializer List Constructor
[source,c++,subs="+quotes"]
----
unordered_multimap(std::initializer_list<value_type> il,
                   size_type n = _implementation-defined_,
                   const hasher& hf = hasher(),
                   const key_equal& eql = key_equal(),
                   const allocator_type& a = allocator_type());
----

Constructs an empty container with at least `n` buckets, using `hf` as the hash function, `eql` as the key equality predicate, `a` as the allocator and a maximum load factor of `1.0` and inserts the elements from `il` into it.

[horizontal]
Requires:;; If the defaults are used, `hasher`, `key_equal` and `allocator_type` need to be https://en.cppreference.com/w/cpp/named_req/DefaultConstructible[DefaultConstructible^].

---
==== Bucket Count Constructor with Allocator
```c++
unordered_multimap(size_type n, const allocator_type& a);
```

Constructs an empty container with at least `n` buckets, using `hf` as the hash function, the default hash function and key equality predicate, `a` as the allocator and a maximum load factor of `1.0`.

[horizontal]
Postconditions:;; `size() == 0`
Requires:;; `hasher` and `key_equal` need to be https://en.cppreference.com/w/cpp/named_req/DefaultConstructible[DefaultConstructible^].

---

==== Bucket Count Constructor with Hasher and Allocator
```c++
unordered_multimap(size_type n, const hasher& hf, const allocator_type& a);
```

Constructs an empty container with at least `n` buckets, using `hf` as the hash function, the default key equality predicate, `a` as the allocator and a maximum load factor of `1.0`.

[horizontal]
Postconditions:;; `size() == 0`
Requires:;; `key_equal` needs to be https://en.cppreference.com/w/cpp/named_req/DefaultConstructible[DefaultConstructible^].

---

==== Iterator Range Constructor with Bucket Count and Allocator
[source,c++,subs="+quotes"]
----
template<class InputIterator>
  unordered_multimap(InputIterator f, InputIterator l, size_type n, const allocator_type& a);
----

Constructs an empty container with at least `n` buckets, using `a` as the allocator, with the default hash function and key equality predicate and a maximum load factor of `1.0` and inserts the elements from `[f, l)` into it.

[horizontal]
Requires:;; `hasher`, `key_equal` need to be https://en.cppreference.com/w/cpp/named_req/DefaultConstructible[DefaultConstructible^].

---

==== Iterator Range Constructor with Bucket Count and Hasher
[source,c++,subs="+quotes"]
----
template<class InputIterator>
  unordered_multimap(InputIterator f, InputIterator l, size_type n, const hasher& hf,
                     const allocator_type& a);
----

Constructs an empty container with at least `n` buckets, using `hf` as the hash function, `a` as the allocator, with the default key equality predicate and a maximum load factor of `1.0` and inserts the elements from `[f, l)` into it.

[horizontal]
Requires:;; `key_equal` needs to be https://en.cppreference.com/w/cpp/named_req/DefaultConstructible[DefaultConstructible^].

---

==== initializer_list Constructor with Allocator

```c++
unordered_multimap(std::initializer_list<value_type> il, const allocator_type& a);
```

Constructs an empty container using `a` as the allocator and a maximum load factor of 1.0 and inserts the elements from `il` into it.

[horizontal]
Requires:;; `hasher` and `key_equal` need to be https://en.cppreference.com/w/cpp/named_req/DefaultConstructible[DefaultConstructible^].

---

==== initializer_list Constructor with Bucket Count and Allocator

```c++
unordered_multimap(std::initializer_list<value_type> il, size_type n, const allocator_type& a);
```

Constructs an empty container with at least `n` buckets, using `a` as the allocator and a maximum load factor of 1.0 and inserts the elements from `il` into it.

[horizontal]
Requires:;; `hasher` and `key_equal` need to be https://en.cppreference.com/w/cpp/named_req/DefaultConstructible[DefaultConstructible^].

---

==== initializer_list Constructor with Bucket Count and Hasher and Allocator

```c++
unordered_multimap(std::initializer_list<value_type> il, size_type n, const hasher& hf,
                   const allocator_type& a);
```

Constructs an empty container with at least `n` buckets, using `hf` as the hash function, `a` as the allocator and a maximum load factor of 1.0 and inserts the elements from `il` into it.

[horizontal]
Requires:;; `key_equal` needs to be https://en.cppreference.com/w/cpp/named_req/DefaultConstructible[DefaultConstructible^].

---

=== Destructor

```c++
~unordered_multimap();
```

[horizontal]
Note:;; The destructor is applied to every element, and all memory is deallocated

---

=== Assignment

==== Copy Assignment

```c++
unordered_multimap& operator=(const unordered_multimap& other);
```

The assignment operator. Copies the contained elements, hash function, predicate and maximum load factor but not the allocator.

If `Alloc::propagate_on_container_copy_assignment` exists and `Alloc::propagate_on_container_copy_assignment::value` is `true`, the allocator is overwritten, if not the copied elements are created using the existing allocator.

[horizontal]
Requires:;; `value_type` is copy constructible

---

==== Move Assignment
```c++
unordered_multimap& operator=(unordered_multimap&& other)
  noexcept(boost::allocator_traits<Allocator>::is_always_equal::value &&
           boost::is_nothrow_move_assignable_v<Hash> &&
           boost::is_nothrow_move_assignable_v<Pred>);
```
The move assignment operator.

If `Alloc::propagate_on_container_move_assignment` exists and `Alloc::propagate_on_container_move_assignment::value` is `true`, the allocator is overwritten, if not the moved elements are created using the existing allocator.

[horizontal]
Requires:;; `value_type` is move constructible.

---

==== Initializer List Assignment
```c++
unordered_multimap& operator=(std::initializer_list<value_type> il);
```

Assign from values in initializer list. All existing elements are either overwritten by the new elements or destroyed.

[horizontal]
Requires:;; `value_type` is https://en.cppreference.com/w/cpp/named_req/CopyInsertable[CopyInsertable^] into the container and https://en.cppreference.com/w/cpp/named_req/CopyAssignable[CopyAssignable^].

=== Iterators

==== begin
```c++
iterator begin() noexcept;
const_iterator begin() const noexcept;
```

[horizontal]
Returns:;; An iterator referring to the first element of the container, or if the container is empty the past-the-end value for the container.

---

==== end
```c++
iterator       end() noexcept;
const_iterator end() const noexcept;
```

[horizontal]
Returns:;; An iterator which refers to the past-the-end value for the container.

---

==== cbegin
```c++
const_iterator cbegin() const noexcept;
```

[horizontal]
Returns:;; A `const_iterator` referring to the first element of the container, or if the container is empty the past-the-end value for the container.

---

==== cend
```c++
const_iterator cend() const noexcept;
```

[horizontal]
Returns:;; A `const_iterator` which refers to the past-the-end value for the container.

---

=== Size and Capacity

==== empty

```c++
[[nodiscard]] bool empty() const noexcept;
```

[horizontal]
Returns:;; `size() == 0`

---

==== size

```c++
size_type size() const noexcept;
```

[horizontal]
Returns:;; `std::distance(begin(), end())`

---

==== max_size

```c++
size_type max_size() const noexcept;
```

[horizontal]
Returns:;; `size()` of the largest possible container.

---

=== Modifiers

==== emplace
```c++
template<class... Args> iterator emplace(Args&&... args);
```

Inserts an object, constructed with the arguments `args`, in the container.

[horizontal]
Requires:;; `value_type` is https://en.cppreference.com/w/cpp/named_req/EmplaceConstructible[EmplaceConstructible^] into `X` from `args`.
Returns:;; An iterator pointing to the inserted element.
Throws:;; If an exception is thrown by an operation other than a call to `hasher` the function has no effect.
Notes:;; Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. +
+
Pointers and references to elements are never invalidated.

---

==== emplace_hint
```c++
template<class... Args> iterator emplace_hint(const_iterator position, Args&&... args);
```

Inserts an object, constructed with the arguments args, in the container.

`position` is a suggestion to where the element should be inserted.

[horizontal]
Requires:;; `value_type` is https://en.cppreference.com/w/cpp/named_req/EmplaceConstructible[EmplaceConstructible^] into `X` from `args`.
Returns:;; An iterator pointing to the inserted element.
Throws:;; If an exception is thrown by an operation other than a call to `hasher` the function has no effect.
Notes:;; The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same key. +
+
Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. +
+
Pointers and references to elements are never invalidated.

---

==== Copy Insert
```c++
iterator insert(const value_type& obj);
```

Inserts `obj` in the container.

[horizontal]
Requires:;; `value_type` is https://en.cppreference.com/w/cpp/named_req/CopyInsertable[CopyInsertable^].
Returns:;; An iterator pointing to the inserted element.
Throws:;; If an exception is thrown by an operation other than a call to `hasher` the function has no effect.
Notes:;; Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. +
+
Pointers and references to elements are never invalidated.

---

==== Move Insert
```c++
iterator insert(value_type&& obj);
```

Inserts `obj` in the container.

[horizontal]
Requires:;; `value_type` is https://en.cppreference.com/w/cpp/named_req/MoveInsertable[MoveInsertable^].
Returns:;; An iterator pointing to the inserted element.
Throws:;; If an exception is thrown by an operation other than a call to `hasher` the function has no effect.
Notes:;; Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. +
+
Pointers and references to elements are never invalidated.

---

==== Emplace Insert
```c++
template<class P> iterator insert(P&& obj);
```

Inserts an element into the container by performing `emplace(std::forward<P>(value))`.

Only participates in overload resolution if `std::is_constructible<value_type, P&&>::value` is `true`.

[horizontal]
Returns:;; An iterator pointing to the inserted element.

---

==== Copy Insert with Hint
```c++
iterator insert(const_iterator hint, const value_type& obj);
```
Inserts `obj` in the container.

`hint` is a suggestion to where the element should be inserted.

[horizontal]
Requires:;; `value_type` is https://en.cppreference.com/w/cpp/named_req/CopyInsertable[CopyInsertable^].
Returns:;; An iterator pointing to the inserted element.
Throws:;; If an exception is thrown by an operation other than a call to `hasher` the function has no effect.
Notes:;; The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same key. +
+
Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. +
+
Pointers and references to elements are never invalidated.

---

==== Move Insert with Hint
```c++
iterator insert(const_iterator hint, value_type&& obj);
```

Inserts `obj` in the container.

`hint` is a suggestion to where the element should be inserted.

[horizontal]
Requires:;; `value_type` is https://en.cppreference.com/w/cpp/named_req/MoveInsertable[MoveInsertable^].
Returns:;; An iterator pointing to the inserted element.
Throws:;; If an exception is thrown by an operation other than a call to `hasher` the function has no effect.
Notes:;; The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same key. +
+
Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. +
+
Pointers and references to elements are never invalidated.

---

==== Emplace Insert with Hint
```c++
template<class P> iterator insert(const_iterator hint, P&& obj);
```

Inserts an element into the container by performing `emplace_hint(hint, std::forward<P>(value))`.

Only participates in overload resolution if `std::is_constructible<value_type, P&&>::value` is `true`.

`hint` is a suggestion to where the element should be inserted.

[horizontal]
Returns:;; An iterator pointing to the inserted element.
Notes:;; The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same key. +
+
Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. +
+
Pointers and references to elements are never invalidated.

---

==== Insert Iterator Range
```c++
template<class InputIterator> void insert(InputIterator first, InputIterator last);
```

Inserts a range of elements into the container.

[horizontal]
Requires:;; `value_type` is https://en.cppreference.com/w/cpp/named_req/EmplaceConstructible[EmplaceConstructible^] into `X` from `*first`.
Throws:;; When inserting a single element, if an exception is thrown by an operation other than a call to `hasher` the function has no effect.
Notes:;; Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. +
+
Pointers and references to elements are never invalidated.

---

==== Insert Initializer List
```c++
void insert(std::initializer_list<value_type> il);
```

Inserts a range of elements into the container.

[horizontal]
Requires:;; `value_type` is https://en.cppreference.com/w/cpp/named_req/CopyInsertable[CopyInsertable^] into the container.
Throws:;; When inserting a single element, if an exception is thrown by an operation other than a call to `hasher` the function has no effect.
Notes:;; Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. +
+
Pointers and references to elements are never invalidated.

---

==== Extract by Iterator
```c++
node_type extract(const_iterator position);
```

Removes the element pointed to by `position`.

[horizontal]
Returns:;; A `node_type` owning the element.
Notes:;; A node extracted using this method can be inserted into a compatible `unordered_map`.

---

==== Extract by Key
```c++
node_type extract(const key_type& k);
template<class K> node_type extract(K&& k);
```

Removes an element with key equivalent to `k`.

[horizontal]
Returns:;; A `node_type` owning the element if found, otherwise an empty `node_type`.
Throws:;; Only throws an exception if it is thrown by `hasher` or `key_equal`.
Notes:;; A node extracted using this method can be inserted into a compatible `unordered_map`. +
+
The `template<class K>` overload only participates in overload resolution if `Hash::is_transparent` and `Pred::is_transparent` are valid member typedefs and neither `iterator` nor `const_iterator` are implicitly convertible from `K`. The library assumes that `Hash` is callable with both `K` and `Key` and that `Pred` is transparent. This enables heterogeneous lookup which avoids the cost of instantiating an instance of the `Key` type.

---

==== Insert with `node_handle`
```c++
iterator insert(node_type&& nh);
```

If `nh` is empty, has no effect.

Otherwise inserts the element owned by `nh`.

[horizontal]
Requires:;; `nh` is empty or `nh.get_allocator()` is equal to the container's allocator.
Returns:;; If `nh` was empty, returns `end()`. +
+
Otherwise returns an iterator pointing to the newly inserted element.
Throws:;; If an exception is thrown by an operation other than a call to `hasher` the function has no effect.
Notes:;; Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. +
+
Pointers and references to elements are never invalidated. +
+
This can be used to insert a node extracted from a compatible `unordered_map`.

---

==== Insert with Hint and `node_handle`
```c++
iterator insert(const_iterator hint, node_type&& nh);
```

If `nh` is empty, has no effect.

Otherwise inserts the element owned by `nh`.

`hint` is a suggestion to where the element should be inserted.

[horizontal]
Requires:;; `nh` is empty or `nh.get_allocator()` is equal to the container's allocator.
Returns:;; If `nh` was empty, returns `end()`. +
+
Otherwise returns an iterator pointing to the newly inserted element.
Throws:;; If an exception is thrown by an operation other than a call to hasher the function has no effect.
Notes:;; The standard is fairly vague on the meaning of the hint. But the only practical way to use it, and the only way that Boost.Unordered supports is to point to an existing element with the same key. +
+
Can invalidate iterators, but only if the insert causes the load factor to be greater to or equal to the maximum load factor. +
+
Pointers and references to elements are never invalidated. +
+
This can be used to insert a node extracted from a compatible `unordered_map`.

---

==== Erase by Position

```c++
iterator erase(iterator position);
iterator erase(const_iterator position);
```

Erase the element pointed to by `position`.

[horizontal]
Returns:;; The iterator following `position` before the erasure.
Throws:;; Only throws an exception if it is thrown by `hasher` or `key_equal`.
Notes:;; In older versions this could be inefficient because it had to search through several buckets to find the position of the returned iterator. The data structure has been changed so that this is no longer the case, and the alternative erase methods have been deprecated.

---

==== Erase by Key
```c++
size_type erase(const key_type& k);
template<class K> size_type erase(K&& k);
```

Erase all elements with key equivalent to `k`.

[horizontal]
Returns:;; The number of elements erased.
Throws:;; Only throws an exception if it is thrown by `hasher` or `key_equal`.
Notes:;; The `template<class K>` overload only participates in overload resolution if `Hash::is_transparent` and `Pred::is_transparent` are valid member typedefs and neither `iterator` nor `const_iterator` are implicitly convertible from `K`. The library assumes that `Hash` is callable with both `K` and `Key` and that `Pred` is transparent. This enables heterogeneous lookup which avoids the cost of instantiating an instance of the `Key` type.

---

==== Erase Range

```c++
iterator erase(const_iterator first, const_iterator last);
```

Erases the elements in the range from `first` to `last`.

[horizontal]
Returns:;; The iterator following the erased elements - i.e. `last`.
Throws:;; Only throws an exception if it is thrown by `hasher` or `key_equal`. +
+
In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.

---

==== quick_erase
```c++
void quick_erase(const_iterator position);
```

Erase the element pointed to by `position`.

[horizontal]
Throws:;; Only throws an exception if it is thrown by `hasher` or `key_equal`. +
+
In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.
Notes:;; This method was implemented because returning an iterator to the next element from erase was expensive, but the container has been redesigned so that is no longer the case. So this method is now deprecated.

---

==== erase_return_void
```c++
void erase_return_void(const_iterator position);
```

Erase the element pointed to by `position`.

[horizontal]
Throws:;; Only throws an exception if it is thrown by `hasher` or `key_equal`. +
+
In this implementation, this overload doesn't call either function object's methods so it is no throw, but this might not be true in other implementations.
Notes:;; This method was implemented because returning an iterator to the next element from erase was expensive, but the container has been redesigned so that is no longer the case. So this method is now deprecated.

---

==== swap
```c++
void swap(unordered_multimap& other)
  noexcept(boost::allocator_traits<Allocator>::is_always_equal::value &&
           boost::is_nothrow_swappable_v<Hash> &&
           boost::is_nothrow_swappable_v<Pred>);
```

Swaps the contents of the container with the parameter.

If `Allocator::propagate_on_container_swap` is declared and `Allocator::propagate_on_container_swap::value` is `true` then the containers' allocators are swapped. Otherwise, swapping with unequal allocators results in undefined behavior.

[horizontal]
Throws:;; Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of `key_equal` or `hasher`.
Notes:;; The exception specifications aren't quite the same as the C++11 standard, as the equality predicate and hash function are swapped using their copy constructors.

---

==== clear
```c++
void clear() noexcept;
```

Erases all elements in the container.

[horizontal]
Postconditions:;; `size() == 0`
Throws:;; Never throws an exception.

---

==== merge
```c++
template<class H2, class P2>
  void merge(unordered_multimap<Key, T, H2, P2, Allocator>& source);
template<class H2, class P2>
  void merge(unordered_multimap<Key, T, H2, P2, Allocator>&& source);
template<class H2, class P2>
  void merge(unordered_map<Key, T, H2, P2, Allocator>& source);
template<class H2, class P2>
  void merge(unordered_map<Key, T, H2, P2, Allocator>&& source);
```

Attempt to "merge" two containers by iterating `source` and extracting all nodes in `source` and inserting them into `*this`.

Because `source` can have a different hash function and key equality predicate, the key of each node in
`source` is rehashed using `this\->hash_function()` and then, if required, compared using `this\->key_eq()`.

The behavior of this function is undefined if `this\->get_allocator() != source.get_allocator()`.

This function does not copy or move any elements and instead simply relocates the nodes from `source`
into `*this`.

[horizontal]
Notes:;;
+
--
* Pointers and references to transferred elements remain valid.
* Invalidates iterators to transferred elements.
* Invalidates iterators belonging to `*this`.
* Iterators to non-transferred elements in `source` remain valid.
--

---

=== Observers

==== get_allocator
```
allocator_type get_allocator() const;
```

---

==== hash_function
```
hasher hash_function() const;
```

[horizontal]
Returns:;; The container's hash function.

---

==== key_eq
```
key_equal key_eq() const;
```

[horizontal]
Returns:;; The container's key equality predicate

---

=== Lookup

==== find
```c++
iterator         find(const key_type& k);
const_iterator   find(const key_type& k) const;
template<class K>
  iterator       find(const K& k);
template<class K>
  const_iterator find(const K& k) const;
template<typename CompatibleKey, typename CompatibleHash, typename CompatiblePredicate>
  iterator       find(CompatibleKey const& k, CompatibleHash const& hash,
                      CompatiblePredicate const& eq);
template<typename CompatibleKey, typename CompatibleHash, typename CompatiblePredicate>
  const_iterator find(CompatibleKey const& k, CompatibleHash const& hash,
                      CompatiblePredicate const& eq) const;

```

[horizontal]
Returns:;; An iterator pointing to an element with key equivalent to `k`, or `b.end()` if no such element exists.
Notes:;; The templated overloads containing `CompatibleKey`, `CompatibleHash` and `CompatiblePredicate` are non-standard extensions which allow you to use a compatible hash function and equality predicate for a key of a different type in order to avoid an expensive type cast. In general, its use is not encouraged and instead the `K` member function templates should be used. +
+
The `template<class K>` overloads only participate in overload resolution if `Hash::is_transparent` and `Pred::is_transparent` are valid member typedefs. The library assumes that `Hash` is callable with both `K` and `Key` and that `Pred` is transparent. This enables heterogeneous lookup which avoids the cost of instantiating an instance of the `Key` type.

---

==== count
```c++
size_type        count(const key_type& k) const;
template<class K>
  size_type      count(const K& k) const;
```

[horizontal]
Returns:;; The number of elements with key equivalent to `k`.
Notes:;; The `template<class K>` overload only participates in overload resolution if `Hash::is_transparent` and `Pred::is_transparent` are valid member typedefs. The library assumes that `Hash` is callable with both `K` and `Key` and that `Pred` is transparent. This enables heterogeneous lookup which avoids the cost of instantiating an instance of the `Key` type.

---

==== contains
```c++
bool             contains(const key_type& k) const;
template<class K>
  bool           contains(const K& k) const;
```

[horizontal]
Returns:;; A boolean indicating whether or not there is an element with key equal to `key` in the container
Notes:;; The `template<class K>` overload only participates in overload resolution if `Hash::is_transparent` and `Pred::is_transparent` are valid member typedefs. The library assumes that `Hash` is callable with both `K` and `Key` and that `Pred` is transparent. This enables heterogeneous lookup which avoids the cost of instantiating an instance of the `Key` type.

---

==== equal_range
```c++
std::pair<iterator, iterator>               equal_range(const key_type& k);
std::pair<const_iterator, const_iterator>   equal_range(const key_type& k) const;
template<class K>
  std::pair<iterator, iterator>             equal_range(const K& k);
template<class K>
  std::pair<const_iterator, const_iterator> equal_range(const K& k) const;
```

[horizontal]
Returns:;; A range containing all elements with key equivalent to `k`. If the container doesn't contain any such elements, returns `std::make_pair(b.end(), b.end())`.
Notes:;; The `template<class K>` overloads only participate in overload resolution if `Hash::is_transparent` and `Pred::is_transparent` are valid member typedefs. The library assumes that `Hash` is callable with both `K` and `Key` and that `Pred` is transparent. This enables heterogeneous lookup which avoids the cost of instantiating an instance of the `Key` type.

---

=== Bucket Interface

==== bucket_count
```c++
size_type bucket_count() const noexcept;
```

[horizontal]
Returns:;; The number of buckets.

---

==== max_bucket_count
```c++
size_type max_bucket_count() const noexcept;
```

[horizontal]
Returns:;; An upper bound on the number of buckets.

---

==== bucket_size
```c++
size_type bucket_size(size_type n) const;
```

[horizontal]
Requires:;; `n < bucket_count()`
Returns:;; The number of elements in bucket `n`.

---

==== bucket
```c++
size_type bucket(const key_type& k) const;
template<class K> size_type bucket(const K& k) const;
```

[horizontal]
Returns:;; The index of the bucket which would contain an element with key `k`.
Postconditions:;; The return value is less than `bucket_count()`.
Notes:;; The `template<class K>` overload only participates in overload resolution if `Hash::is_transparent` and `Pred::is_transparent` are valid member typedefs. The library assumes that `Hash` is callable with both `K` and `Key` and that `Pred` is transparent. This enables heterogeneous lookup which avoids the cost of instantiating an instance of the `Key` type.

---

==== begin

```c++
local_iterator begin(size_type n);
const_local_iterator begin(size_type n) const;
```

[horizontal]
Requires:;; `n` shall be in the range `[0, bucket_count())`.
Returns:;; A local iterator pointing the first element in the bucket with index `n`.

---

==== end
```c++
local_iterator end(size_type n);
const_local_iterator end(size_type n) const;
```

[horizontal]
Requires:;; `n` shall be in the range `[0, bucket_count())`.
Returns:;; A local iterator pointing the 'one past the end' element in the bucket with index `n`.

---

==== cbegin
```c++
const_local_iterator cbegin(size_type n) const;
```

[horizontal]
Requires:;; `n` shall be in the range `[0, bucket_count())`.
Returns:;; A constant local iterator pointing the first element in the bucket with index `n`.

---

==== cend
```c++
const_local_iterator cend(size_type n) const;
```

[horizontal]
Requires:;; `n` shall be in the range `[0, bucket_count())`.
Returns:;; A constant local iterator pointing the 'one past the end' element in the bucket with index `n`.

---

=== Hash Policy

==== load_factor
```c++
float load_factor() const noexcept;
```

[horizontal]
Returns:;; The average number of elements per bucket.

---

==== max_load_factor

```c++
float max_load_factor() const noexcept;
```

[horizontal]
Returns:;; Returns the current maximum load factor.

---

==== Set max_load_factor
```c++
void max_load_factor(float z);
```

[horizontal]
Effects:;; Changes the container's maximum load factor, using `z` as a hint.

---


==== rehash
```c++
void rehash(size_type n);
```

Changes the number of buckets so that there are at least `n` buckets, and so that the load factor is less than or equal to the maximum load factor. When applicable, this will either grow or shrink the `bucket_count()` associated with the container.

When `size() == 0`, `rehash(0)` will deallocate the underlying buckets array.

Invalidates iterators, and changes the order of elements. Pointers and references to elements are not invalidated.

[horizontal]
Throws:;; The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function.

---

==== reserve
```c++
void reserve(size_type n);
```

Equivalent to `a.rehash(ceil(n / a.max_load_factor()))`, or `a.rehash(1)` if `n > 0` and `a.max_load_factor() == std::numeric_limits<float>::infinity()`.

Similar to `rehash`, this function can be used to grow or shrink the number of buckets in the container.

Invalidates iterators, and changes the order of elements. Pointers and references to elements are not invalidated.

[horizontal]
Throws:;; The function has no effect if an exception is thrown, unless it is thrown by the container's hash function or comparison function.

---

=== Deduction Guides
A deduction guide will not participate in overload resolution if any of the following are true:

  - It has an `InputIterator` template parameter and a type that does not qualify as an input iterator is deduced for that parameter.
  - It has an `Allocator` template parameter and a type that does not qualify as an allocator is deduced for that parameter.
  - It has a `Hash` template parameter and an integral type or a type that qualifies as an allocator is deduced for that parameter.
  - It has a `Pred` template parameter and a type that qualifies as an allocator is deduced for that parameter.

A `size_­type` parameter type in a deduction guide refers to the `size_­type` member type of the
container type deduced by the deduction guide. Its default value coincides with the default value
of the constructor selected.

==== __iter-value-type__
[listings,subs="+macros,+quotes"]
-----
template<class InputIterator>
  using __iter-value-type__ =
    typename std::iterator_traits<InputIterator>::value_type; // exposition only
-----

==== __iter-key-type__
[listings,subs="+macros,+quotes"]
-----
template<class InputIterator>
  using __iter-key-type__ = std::remove_const_t<
    std::tuple_element_t<0, xref:#unordered_multimap_iter_value_type[__iter-value-type__]<InputIterator>>>; // exposition only
-----

==== __iter-mapped-type__
[listings,subs="+macros,+quotes"]
-----
template<class InputIterator>
  using __iter-mapped-type__ =
    std::tuple_element_t<1, xref:#unordered_multimap_iter_value_type[__iter-value-type__]<InputIterator>>;  // exposition only
-----

==== __iter-to-alloc-type__
[listings,subs="+macros,+quotes"]
-----
template<class InputIterator>
  using __iter-to-alloc-type__ = std::pair<
    std::add_const_t<std::tuple_element_t<0, xref:#unordered_multimap_iter_value_type[__iter-value-type__]<InputIterator>>>,
    std::tuple_element_t<1, xref:#unordered_multimap_iter_value_type[__iter-value-type__]<InputIterator>>>; // exposition only
-----

=== Equality Comparisons

==== operator==
```c++
template<class Key, class T, class Hash, class Pred, class Alloc>
  bool operator==(const unordered_multimap<Key, T, Hash, Pred, Alloc>& x,
                  const unordered_multimap<Key, T, Hash, Pred, Alloc>& y);
```

Return `true` if `x.size() == y.size()` and for every equivalent key group in `x`, there is a group in `y` for the same key, which is a permutation (using `operator==` to compare the value types).

[horizontal]
Notes:;; Behavior is undefined if the two containers don't have equivalent equality predicates.

---

==== operator!=
```c++
template<class Key, class T, class Hash, class Pred, class Alloc>
  bool operator!=(const unordered_multimap<Key, T, Hash, Pred, Alloc>& x,
                  const unordered_multimap<Key, T, Hash, Pred, Alloc>& y);
```

Return `false` if `x.size() == y.size()` and for every equivalent key group in `x`, there is a group in `y` for the same key, which is a permutation (using `operator==` to compare the value types).

[horizontal]
Notes:;; Behavior is undefined if the two containers don't have equivalent equality predicates.

---

=== Swap
```c++
template<class Key, class T, class Hash, class Pred, class Alloc>
  void swap(unordered_multimap<Key, T, Hash, Pred, Alloc>& x,
            unordered_multimap<Key, T, Hash, Pred, Alloc>& y)
    noexcept(noexcept(x.swap(y)));
```

Swaps the contents of `x` and `y`.

If `Allocator::propagate_on_container_swap` is declared and `Allocator::propagate_on_container_swap::value` is `true` then the containers' allocators are swapped. Otherwise, swapping with unequal allocators results in undefined behavior.

[horizontal]
Effects:;; `x.swap(y)`
Throws:;; Doesn't throw an exception unless it is thrown by the copy constructor or copy assignment operator of `key_equal` or `hasher`.
Notes:;; The exception specifications aren't quite the same as the C++11 standard, as the equality predicate and hash function are swapped using their copy constructors.

---

=== erase_if
```c++
template<class K, class T, class H, class P, class A, class Predicate>
  typename unordered_multimap<K, T, H, P, A>::size_type
    erase_if(unordered_multimap<K, T, H, P, A>& c, Predicate pred);
```

Traverses the container `c` and removes all elements for which the supplied predicate returns `true`.

[horizontal]
Returns:;; The number of erased elements.
Notes:;; Equivalent to: +
+
```c++
auto original_size = c.size();
for (auto i = c.begin(), last = c.end(); i != last; ) {
  if (pred(*i)) {
    i = c.erase(i);
  } else {
    ++i;
  }
}
return original_size - c.size();
```
+
Note that the references passed to `pred` are non-const.

=== Serialization

``unordered_multimap``s can be archived/retrieved by means of
link:../../../../../serialization/index.html[Boost.Serialization^] using the API provided
by this library. Both regular and XML archives are supported.

==== Saving an unordered_multimap to an archive

Saves all the elements of an `unordered_multimap` `x` to an archive (XML archive) `ar`.

[horizontal]
Requires:;; `std::remove_const<key_type>::type` and `std::remove_const<mapped_type>::type`
are serializable (XML serializable), and they do support Boost.Serialization
`save_construct_data`/`load_construct_data` protocol (automatically suported by
https://en.cppreference.com/w/cpp/named_req/DefaultConstructible[DefaultConstructible^]
types).

---

==== Loading an unordered_multimap from an archive

Deletes all preexisting elements of an `unordered_multimap` `x` and inserts
from an archive (XML archive) `ar` restored copies of the elements of the
original `unordered_multimap` `other` saved to the storage read by `ar`.

[horizontal]
Requires:;; `value_type` is https://en.cppreference.com/w/cpp/named_req/EmplaceConstructible[EmplaceConstructible^]
from `(std::remove_const<key_type>::type&&, std::remove_const<mapped_type>::type&&)`.
`x.key_equal()` is functionally equivalent to `other.key_equal()`.
Note:;; If the archive was saved using a release of Boost prior to Boost 1.84,
the configuration macro `BOOST_UNORDERED_ENABLE_SERIALIZATION_COMPATIBILITY_V0`
has to be globally defined for this operation to succeed; otherwise, an exception is thrown.

---

==== Saving an iterator/const_iterator to an archive

Saves the positional information of an `iterator` (`const_iterator`) `it`
to an archive (XML archive) `ar`. `it` can be and `end()` iterator.

[horizontal]
Requires:;; The `unordered_multimap` `x` pointed to by `it` has been previously saved to `ar`,
and no modifying operations have been issued on `x` between saving of `x` and
saving of `it`.

---

==== Loading an iterator/const_iterator from an archive

Makes an `iterator` (`const_iterator`) `it` point to the restored position of
the original `iterator` (`const_iterator`) saved to the storage read by
an archive (XML archive) `ar`.

[horizontal]
Requires:;; If `x` is the `unordered_multimap` `it` points to, no modifying operations
have been issued on `x` between loading of `x` and loading of `it`.