BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bslstl_unorderedmultimap_cpp03.h
Go to the documentation of this file.
1/// @file bslstl_unorderedmultimap_cpp03.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bslstl_unorderedmultimap_cpp03.h -*-C++-*-
8
9// Automatically generated file. **DO NOT EDIT**
10
11#ifndef INCLUDED_BSLSTL_UNORDEREDMULTIMAP_CPP03
12#define INCLUDED_BSLSTL_UNORDEREDMULTIMAP_CPP03
13
14/// @defgroup bslstl_unorderedmultimap_cpp03 bslstl_unorderedmultimap_cpp03
15/// @brief Provide C++03 implementation for bslstl_unorderedmultimap.h
16/// @addtogroup bsl
17/// @{
18/// @addtogroup bslstl
19/// @{
20/// @addtogroup bslstl_unorderedmultimap_cpp03
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bslstl_unorderedmultimap_cpp03-purpose"> Purpose</a>
25/// * <a href="#bslstl_unorderedmultimap_cpp03-classes"> Classes </a>
26/// * <a href="#bslstl_unorderedmultimap_cpp03-description"> Description </a>
27///
28/// # Purpose {#bslstl_unorderedmultimap_cpp03-purpose}
29/// Provide C++03 implementation for bslstl_unorderedmultimap.h
30///
31/// # Classes {#bslstl_unorderedmultimap_cpp03-classes}
32/// See bslstl_unorderedmultimap.h for list of classes
33///
34/// @see bslstl_unorderedmultimap
35///
36/// # Description {#bslstl_unorderedmultimap_cpp03-description}
37/// This component is the C++03 translation of a C++11 component,
38/// generated by the 'sim_cpp11_features.pl' program. If the original header
39/// contains any specially delimited regions of C++11 code, then this generated
40/// file contains the C++03 equivalent, i.e., with variadic templates expanded
41/// and rvalue-references replaced by 'bslmf::MovableRef' objects. The header
42/// code in this file is designed to be '#include'd into the original header
43/// when compiling with a C++03 compiler. If there are no specially delimited
44/// regions of C++11 code, then this header contains no code and is not
45/// '#include'd in the original header.
46///
47/// Generated on Thu Mar 12 11:46:48 2026
48/// Command line: sim_cpp11_features.pl bslstl_unorderedmultimap.h
49/// @}
50/** @} */
51/** @} */
52
53/** @addtogroup bsl
54 * @{
55 */
56/** @addtogroup bslstl
57 * @{
58 */
59/** @addtogroup bslstl_unorderedmultimap_cpp03
60 * @{
61 */
62
63#ifdef COMPILING_BSLSTL_UNORDEREDMULTIMAP_H
64
65namespace bsl {
66
67/// This class template implements a value-semantic container type holding a
68/// collection of (possibly equivalent) keys (of the template parameter type
69/// `KEY`), each mapped to their associated values (of another template
70/// parameter type `VALUE`).
71///
72/// This class:
73/// * supports a complete set of *value-semantic* operations
74/// - except for BDEX serialization
75/// * is *exception-neutral* (agnostic except for the `at` method)
76/// * is *alias-safe*
77/// * is `const` *thread-safe*
78/// For terminology see @ref bsldoc_glossary .
79///
80/// See @ref bslstl_unorderedmultimap_cpp03
81template <class KEY,
82 class VALUE,
83 class HASH = bsl::hash<KEY>,
84 class EQUAL = bsl::equal_to<KEY>,
86class unordered_multimap {
87
88 private:
89 // PRIVATE TYPES
90
91 /// This `typedef` is an alias for the allocator traits type associated
92 /// with this container.
93 typedef bsl::allocator_traits<ALLOCATOR> AllocatorTraits;
94
95 /// This `typedef` is an alias for the type of key-value pair objects
96 /// maintained by this unordered multimap.
97 typedef pair<const KEY, VALUE> ValueType;
98
99 /// This `typedef` is an alias for the policy used internally by this
100 /// container to extract the `KEY` value from the values maintained by
101 /// this unordered multimap.
102 typedef ::BloombergLP::bslstl::UnorderedMapKeyConfiguration<const KEY,
103 ValueType>
104 ListConfiguration;
105
106 /// This `typedef` is an alias for the template instantiation of the
107 /// underlying `bslstl::HashTable` used to implement this unordered
108 /// multimap.
109 typedef ::BloombergLP::bslstl::HashTable<ListConfiguration,
110 HASH,
111 EQUAL,
112 ALLOCATOR> Impl;
113
114 /// This `typedef` is an alias for the type of links maintained by the
115 /// linked list of elements held by the underlying `bslstl::HashTable`.
116 typedef ::BloombergLP::bslalg::BidirectionalLink HashTableLink;
117
118 /// This `typedef` is a convenient alias for the utility associated with
119 /// movable references.
120 typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;
121
122 // FRIENDS
123 template <class KEY2,
124 class VALUE2,
125 class HASH2,
126 class EQUAL2,
127 class ALLOCATOR2>
128 friend bool operator==(
129 const unordered_multimap<KEY2, VALUE2, HASH2, EQUAL2, ALLOCATOR2>&,
130 const unordered_multimap<KEY2, VALUE2, HASH2, EQUAL2, ALLOCATOR2>&);
131
132 public:
133 // PUBLIC TYPES
134 typedef KEY key_type;
135 typedef VALUE mapped_type;
137 typedef HASH hasher;
138 typedef EQUAL key_equal;
139 typedef ALLOCATOR allocator_type;
140
141 typedef value_type& reference;
142 typedef const value_type& const_reference;
143
144 typedef typename AllocatorTraits::size_type size_type;
146 typedef typename AllocatorTraits::pointer pointer;
148
149 typedef ::BloombergLP::bslstl::HashTableIterator<
151
152 typedef ::BloombergLP::bslstl::HashTableIterator<
154
155 typedef ::BloombergLP::bslstl::HashTableBucketIterator<
157
158 typedef ::BloombergLP::bslstl::HashTableBucketIterator<
160
161 private:
162 // DATA
163 Impl d_impl;
164
165 public:
166 // CREATORS
167
168 /// Create an empty unordered multimap. Optionally specify an
169 /// `initialNumBuckets` indicating the minimum initial size of the array
170 /// of buckets of this container. If `initialNumBuckets` is not
171 /// supplied, a single empty bucket is used. Optionally specify a
172 /// `hashFunction` used to generate the hash values for the keys
173 /// contained in this unordered multimap. If `hashFunction` is not
174 /// supplied, a default-constructed object of the (template parameter)
175 /// type `HASH` is used. Optionally specify a key-equivalence functor
176 /// `keyEqual` used to verify that two keys are equivalent. If
177 /// `keyEqual` is not supplied, a default-constructed object of the
178 /// (template parameter) type `EQUAL` is used. Optionally specify a
179 /// `basicAllocator` used to supply memory. If `basicAllocator` is not
180 /// supplied, a default-constructed object of the (template parameter)
181 /// type `ALLOCATOR` is used. If the type `ALLOCATOR` is
182 /// `bsl::allocator` (the default), then `basicAllocator`, if supplied,
183 /// shall be convertible to `bslma::Allocator *`. If the type
184 /// `ALLOCATOR` is `bsl::allocator` and `basicAllocator` is not
185 /// supplied, the currently installed default allocator is used.
187 explicit unordered_multimap(size_type initialNumBuckets,
188 const HASH& hashFunction = HASH(),
189 const EQUAL& keyEqual = EQUAL(),
190 const ALLOCATOR& basicAllocator = ALLOCATOR());
191 unordered_multimap(size_type initialNumBuckets,
192 const HASH& hashFunction,
193 const ALLOCATOR& basicAllocator);
194 unordered_multimap(size_type initialNumBuckets,
195 const ALLOCATOR& basicAllocator);
196 explicit unordered_multimap(const ALLOCATOR& basicAllocator);
197
198 /// Create an unordered multimap having the same value as the specified
199 /// `original` object. Use a copy of `original.hash_function()` to
200 /// generate hash values for the keys contained in this unordered
201 /// multimap. Use a copy of `original.key_eq()` to verify that two keys
202 /// are equivalent. Use the allocator returned by
203 /// `bsl::allocator_traits<ALLOCATOR>::
204 /// select_on_container_copy_construction(original.get_allocator())` to
205 /// allocate memory. This method requires that the (template parameter)
206 /// types `KEY` and `VALUE` both be `copy-insertable` into this
207 /// unordered multimap (see {Requirements on `KEY` and `VALUE`}).
208 unordered_multimap(const unordered_multimap& original);
209
210 /// Create an unordered multimap having the same value as the specified
211 /// `original` object by moving (in constant time) the contents of
212 /// `original` to the new unordered multimap. Use a copy of
213 /// `original.hash_function()` to generate hash values for the keys
214 /// contained in this unordered multimap. Use a copy of
215 /// `original.key_eq()` to verify that two keys are equivalent. The
216 /// allocator associated with `original` is propagated for use in the
217 /// newly-created unordered multimap. `original` is left in a valid but
218 /// unspecified state.
220 BloombergLP::bslmf::MovableRef<unordered_multimap> original);
221
222 /// Create an unordered multimap having the same value as the specified
223 /// `original` object that uses the specified `basicAllocator` to supply
224 /// memory. Use a copy of `original.hash_function()` to generate hash
225 /// values for the keys contained in this unordered multimap. Use a
226 /// copy of `original.key_eq()` to verify that two keys are equivalent.
227 /// This method requires that the (template parameter) types `KEY` and
228 /// `VALUE` both be `copy-insertable` into this unordered multimap (see {Requirements on `KEY` and `VALUE`}).
229 ///
230 /// \note Note that a
231 /// `bslma::Allocator *` can be supplied for `basicAllocator` if the
232 /// (template parameter) type `ALLOCATOR` is `bsl::allocator` (the
233 /// default).
235 const unordered_multimap& original,
236 const typename type_identity<ALLOCATOR>::type& basicAllocator);
237
238 /// Create an unordered multimap having the same value as the specified
239 /// `original` object that uses the specified `basicAllocator` to supply
240 /// memory. The contents of `original` are moved (in constant time) to
241 /// the new unordered multimap if `basicAllocator ==
242 /// original.get_allocator()`, and are move-inserted (in linear time)
243 /// using `basicAllocator` otherwise. `original` is left in a valid but
244 /// unspecified state. Use a copy of `original.hash_function()` to
245 /// generate hash values for the keys contained in this unordered
246 /// multimap. Use a copy of `original.key_eq()` to verify that two keys
247 /// are equivalent. This method requires that the (template parameter)
248 /// types `KEY` and `VALUE` both be `move-insertable` into this
249 /// unordered multimap (see {Requirements on `KEY` and `VALUE`}).
250 ///
251 /// \note Note that a `bslma::Allocator *` can be supplied for `basicAllocator` if
252 /// the (template parameter) type `ALLOCATOR` is `bsl::allocator` (the
253 /// default).
255 BloombergLP::bslmf::MovableRef<unordered_multimap> original,
256 const typename type_identity<ALLOCATOR>::type& basicAllocator);
257
258 /// Create an unordered multimap, and insert each `value_type` object in
259 /// the sequence starting at the specified `first` element, and ending
260 /// immediately before the specified `last` element. Optionally specify
261 /// an `initialNumBuckets` indicating the minimum initial size of the
262 /// array of buckets of this container. If `initialNumBuckets` is not
263 /// supplied, a single empty bucket is used if `first` and `last` denote
264 /// an empty range, and an unspecified number of buckets is used
265 /// otherwise. Optionally specify a `hashFunction` used to generate
266 /// hash values for the keys contained in this unordered multimap. If
267 /// `hashFunction` is not supplied, a default-constructed object of
268 /// (template parameter) type `HASH` is used. Optionally specify a
269 /// key-equivalence functor `keyEqual` used to verify that two keys are
270 /// equivalent. If `keyEqual` is not supplied, a default-constructed
271 /// object of (template parameter) type `EQUAL` is used. Optionally
272 /// specify a `basicAllocator` used to supply memory. If
273 /// `basicAllocator` is not supplied, a default-constructed object of
274 /// the (template parameter) type `ALLOCATOR` is used. If the type
275 /// `ALLOCATOR` is `bsl::allocator` and `basicAllocator` is not
276 /// supplied, the currently installed default allocator is used to
277 /// supply memory. The (template parameter) type `INPUT_ITERATOR` shall
278 /// meet the requirements of an input iterator defined in the C++11
279 /// standard [24.2.3] providing access to values of a type convertible
280 /// to `value_type`, and `value_type` must be `emplace-constructible`
281 /// from `*i` into this unordered multimap, where `i` is a
282 /// dereferenceable iterator in the range `[first .. last)` (see
283 /// {Requirements on `KEY` and `VALUE`}).
284 ///
285 /// \pre The behavior is undefined unless `first` and `last` refer to a sequence of valid values where `first` is at a position at or before `last`.
286 ///
287 /// \note Note that a
288 /// `bslma::Allocator *` can be supplied for `basicAllocator` if the
289 /// type `ALLOCATOR` is `bsl::allocator` (the default).
290 template <class INPUT_ITERATOR>
291 unordered_multimap(INPUT_ITERATOR first,
292 INPUT_ITERATOR last,
293 size_type initialNumBuckets = 0,
294 const HASH& hashFunction = HASH(),
295 const EQUAL& keyEqual = EQUAL(),
296 const ALLOCATOR& basicAllocator = ALLOCATOR());
297 template <class INPUT_ITERATOR>
298 unordered_multimap(INPUT_ITERATOR first,
299 INPUT_ITERATOR last,
300 size_type initialNumBuckets,
301 const HASH& hashFunction,
302 const ALLOCATOR& basicAllocator);
303 template <class INPUT_ITERATOR>
304 unordered_multimap(INPUT_ITERATOR first,
305 INPUT_ITERATOR last,
306 size_type initialNumBuckets,
307 const ALLOCATOR& basicAllocator);
308 template <class INPUT_ITERATOR>
309 unordered_multimap(INPUT_ITERATOR first,
310 INPUT_ITERATOR last,
311 const ALLOCATOR& basicAllocator);
312
313#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
314# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
315 template <
316 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
317 class = bsl::enable_if_t<
318 std::is_invocable_v<EQUAL, const KEY &, const KEY &>>,
319 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
320 >
321# endif
323 std::initializer_list<value_type> values,
324 size_type initialNumBuckets = 0,
325 const HASH& hashFunction = HASH(),
326 const EQUAL& keyEqual = EQUAL(),
327 const ALLOCATOR& basicAllocator = ALLOCATOR());
328# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
329 template <
330 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
331 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
332 >
333# endif
334 unordered_multimap(std::initializer_list<value_type> values,
335 size_type initialNumBuckets,
336 const HASH& hashFunction,
337 const ALLOCATOR& basicAllocator);
338# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
339 template <
340 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
341 >
342# endif
343 unordered_multimap(std::initializer_list<value_type> values,
344 size_type initialNumBuckets,
345 const ALLOCATOR& basicAllocator);
346# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
347 /// Create an unordered multimap and insert each `value_type` object in
348 /// the specified `values` initializer list. Optionally specify an
349 /// `initialNumBuckets` indicating the minimum initial size of the array
350 /// of buckets of this container. If `initialNumBuckets` is not
351 /// supplied, a single empty bucket is used if `values` is empty, and an
352 /// unspecified number of buckets is used otherwise. Optionally specify
353 /// a `hashFunction` used to generate the hash values for the keys
354 /// contained in this unordered multimap. If `hashFunction` is not
355 /// supplied, a default-constructed object of the (template parameter)
356 /// type `HASH` is used. Optionally specify a key-equivalence functor
357 /// `keyEqual` used to verify that two keys are equivalent. If
358 /// `keyEqual` is not supplied, a default-constructed object of the
359 /// (template parameter) type `EQUAL` is used. Optionally specify a
360 /// `basicAllocator` used to supply memory. If `basicAllocator` is not
361 /// supplied, a default-constructed object of the (template parameter)
362 /// type `ALLOCATOR` is used. If the type `ALLOCATOR` is
363 /// `bsl::allocator` and `basicAllocator` is not supplied, the currently
364 /// installed default allocator is used to supply memory. This method
365 /// requires that the (template parameter) types `KEY` and `VALUE` both
366 /// be `copy-insertable` into this unordered multimap (see {Requirements on `KEY` and `VALUE`}).
367 ///
368 /// \note Note that a `bslma::Allocator *` can be
369 /// supplied for `basicAllocator` if the type `ALLOCATOR` is
370 /// `bsl::allocator` (the default).
371 template <
372 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
373 >
374# endif
375 unordered_multimap(std::initializer_list<value_type> values,
376 const ALLOCATOR& basicAllocator);
377#endif
378
379 /// Create an unordered multimap, and insert each `value_type` object in
380 /// the specified `range`. Optionally specify an `initialNumBuckets`
381 /// indicating the initial size of the array of buckets of this
382 /// container. If `initialNumBuckets` is not supplied, an
383 /// implementation-defined value is used. Optionally specify a
384 /// `hashFunction` used to generate the hash values for each key value
385 /// contained in this unordered multimap. If `hashFunction` is not
386 /// supplied, a default-constructed object of the (template parameter)
387 /// type `HASH` is used. Optionally specify a key-equality functor
388 /// `keyEqual` used to determine whether two keys have the same value.
389 /// If `keyEqual` is not supplied, a default-constructed object of the
390 /// (template parameter) type `EQUAL` is used. Optionally specify a
391 /// `basicAllocator` used to supply memory. If `basicAllocator` is not
392 /// supplied, a default-constructed object of the (template parameter)
393 /// type `ALLOCATOR` is used. If the type `ALLOCATOR` is
394 /// `bsl::allocator` (the default), then `basicAllocator`, if supplied,
395 /// shall be convertible to `bslma::Allocator *`. If the type
396 /// `ALLOCATOR` is `bsl::allocator` and `basicAllocator` is not
397 /// supplied, the currently installed default allocator is used. This
398 /// operation has `O[N]` complexity, where `N` is the number of elements in `range`.
399 ///
400 /// \note Note that `RANGE` must meet the requirements of an
401 /// input range and the values from `range` must have a type matching or
402 /// convertible to `value_type`.
403 template <class RANGE>
405 value_type)
407 bsl::from_range_t ,
408 BSLS_COMPILERFEATURES_FORWARD_REF(RANGE) range,
409 size_type initialNumBuckets = 0,
410 const HASH& hashFunction = HASH(),
411 const EQUAL& keyEqual = EQUAL(),
412 const ALLOCATOR& basicAllocator = ALLOCATOR())
413 : d_impl(hashFunction,
414 keyEqual,
415 initialNumBuckets,
416 1.0f,
417 basicAllocator)
418 {
419 // Defined inline to avoid `clang` and Windows errors.
420#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
421 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
422 if constexpr (ranges::sized_range<RANGE>) {
423 constructFromRange(bsl::ranges::begin(range),
424 bsl::ranges::end (range),
425 bsl::ranges::size (range));
426 } else // ...
427#endif
428 {
429 constructFromRange(bsl::ranges::begin(range),
430 bsl::ranges::end (range));
431 }
432 }
433
434 template <class RANGE>
439 size_type initialNumBuckets,
440 const HASH& hashFunction,
441 const ALLOCATOR& basicAllocator)
442 : d_impl(hashFunction, EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
443 {
444 // Defined inline to avoid `clang` error.
445
447 range,
448 initialNumBuckets,
449 hashFunction,
450 EQUAL(),
451 basicAllocator);
452 this->swap(other);
453 }
454
455 template <class RANGE>
460 size_type initialNumBuckets,
461 const ALLOCATOR& basicAllocator)
462 : d_impl(HASH(), EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
463 {
464 // Defined inline to avoid `clang` error.
465
467 range,
468 initialNumBuckets,
469 HASH(),
470 EQUAL(),
471 basicAllocator);
472 this->swap(other);
473 }
474
475 template <class RANGE>
480 const ALLOCATOR& basicAllocator)
481 : d_impl(HASH(), EQUAL(), 0, 1.0f, basicAllocator)
482 {
483 // Defined inline to avoid `clang` error.
484
486 range,
487 0,
488 HASH(),
489 EQUAL(),
490 basicAllocator);
491 this->swap(other);
492 }
493
494 /// Destroy this object.
496
497 // MANIPULATORS
498
499 /// Assign to this object the value, hash function, and key-equivalence
500 /// comparator of the specified `rhs` object, propagate to this object
501 /// the allocator of `rhs` if the `ALLOCATOR` type has trait
502 /// @ref propagate_on_container_copy_assignment , and return a reference
503 /// providing modifiable access to this object. If an exception is
504 /// thrown, `*this` is left in a valid but unspecified state. This
505 /// method requires that the (template parameter) types `KEY` and
506 /// `VALUE` both be `copy-assignable` and `copy-insertable` into this
507 /// unordered multimap (see {Requirements on `KEY` and `VALUE`}).
509
510 /// Assign to this object the value, hash function, and key-equivalence
511 /// comparator of the specified `rhs` object, propagate to this object
512 /// the allocator of `rhs` if the `ALLOCATOR` type has trait
513 /// @ref propagate_on_container_move_assignment , and return a reference
514 /// providing modifiable access to this object. The contents of `rhs`
515 /// are moved (in constant time) to this unordered multimap if
516 /// `get_allocator() == rhs.get_allocator()` (after accounting for the
517 /// aforementioned trait); otherwise, all elements in this unordered
518 /// multimap are either destroyed or move-assigned to, and each
519 /// additional element in `rhs` is move-inserted into this unordered
520 /// multimap. `rhs` is left in a valid but unspecified state, and if an
521 /// exception is thrown, `*this` is left in a valid but unspecified
522 /// state. This method requires that the (template parameter) types
523 /// `KEY` and `VALUE` both be `move-assignable` and `move-insertable`
524 /// into this unordered multimap (see {Requirements on `KEY` and
525 /// `VALUE`}).
527 operator=(BloombergLP::bslmf::MovableRef<unordered_multimap> rhs)
529 AllocatorTraits::is_always_equal::value &&
530 std::is_nothrow_move_assignable<HASH>::value &&
531 std::is_nothrow_move_assignable<EQUAL>::value);
532
533#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
534 /// Assign to this object the value resulting from first clearing this
535 /// unordered multimap and then inserting each `value_type` object in
536 /// the specified `values` initializer list, and return a reference
537 /// providing modifiable access to this object. This method requires
538 /// that the (template parameter) types `KEY` and `VALUE` both be
539 /// `copy-insertable` into this unordered multimap (see {Requirements on
540 /// `KEY` and `VALUE`}).
541 unordered_multimap& operator=(std::initializer_list<value_type> values);
542#endif
543
544 /// Return an iterator providing modifiable access to the first
545 /// `value_type` object (in the sequence of `value_type` objects)
546 /// maintained by this unordered multimap, or the `end` iterator if this
547 /// unordered multimap is empty.
549
550 /// Return an iterator providing modifiable access to the past-the-end
551 /// position in the sequence of `value_type` objects maintained by this
552 /// unordered multimap.
554
555 /// Return a local iterator providing modifiable access to the first
556 /// `value_type` object in the sequence of `value_type` objects of the
557 /// bucket having the specified `index` in the array of buckets
558 /// maintained by this unordered multimap, or the `end(index)` iterator if the indexed bucket is empty.
559 ///
560 /// \pre The behavior is undefined unless
561 /// `index < bucket_count()`.
563
564 /// Return a local iterator providing modifiable access to the
565 /// past-the-end position in the sequence of `value_type` objects of the
566 /// bucket having the specified `index` in the array of buckets
567 /// maintained by this unordered multimap.
568 ///
569 /// \pre The behavior is undefined unless `index < bucket_count()`.
571
572 /// Remove all entries from this unordered multimap.
573 /// \note Note that this
574 /// object will be empty after this call, but allocated memory may be
575 /// retained for future use.
577
578 /// Return a pair of iterators providing modifiable access to the
579 /// sequence of `value_type` objects in this unordered multimap with a
580 /// key equivalent to the specified `key`, where the first iterator is
581 /// positioned at the start of the sequence, and the second is
582 /// positioned one past the end of the sequence. If this unordered
583 /// multimap contains no `value_type` objects with a key equivalent to
584 /// `key`, then the two returned iterators will have the same value.
585 ///
586 /// \pre The behavior is undefined unless `key` is equivalent to the key of
587 /// the elements of at most one equivalent-key group in this unordered
588 /// multimap.
589 template <class LOOKUP_KEY>
590 typename enable_if<
591 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
592 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
593 pair<iterator, iterator> >::type
594 equal_range(const LOOKUP_KEY& key)
595 {
596 // Note: implemented inline due to Sun CC compilation error.
597 typedef bsl::pair<iterator, iterator> ResultType;
598 HashTableLink *first;
599 HashTableLink *last;
600 d_impl.findRange(&first, &last, key);
601 return ResultType(iterator(first), iterator(last));
602 }
603
604 /// Return a pair of iterators providing modifiable access to the
605 /// sequence of `value_type` objects in this unordered multimap with a
606 /// key equivalent to the specified `key`, where the first iterator is
607 /// positioned at the start of the sequence, and the second is
608 /// positioned one past the end of the sequence. If this unordered
609 /// multimap contains no `value_type` objects with a key equivalent to
610 /// `key`, then the two returned iterators will have the same value.
611 pair<iterator, iterator> equal_range(const key_type& key);
612
613 /// Remove from this unordered multimap all `value_type` objects with a
614 /// key equivalent to the specified `key`, if such exist, and return the
615 /// number of objects erased; otherwise, if there are no `value_type`
616 /// objects with a key equivalent to `key`, return 0 with no other
617 /// effect. This method invalidates only iterators and references to
618 /// the removed element and previously saved values of the `end()`
619 /// iterator, and preserves the relative order of the elements not
620 /// removed.
621 size_type erase(const key_type& key);
622 template <class t_KEY>
623 typename enable_if<
624 BloombergLP::bslmf::IsTransparentPredicate<HASH, t_KEY>::value &&
625 BloombergLP::bslmf::IsTransparentPredicate<EQUAL,t_KEY>::value &&
626 !is_convertible<BSLS_COMPILERFEATURES_FORWARD_REF(t_KEY),
627 iterator>::value &&
628 !is_convertible<BSLS_COMPILERFEATURES_FORWARD_REF(t_KEY),
629 const_iterator>::value,
631 {
632 // Implemented inline due to Sun CC compilation error.
633 size_type count = 0;
634 // Our implementation always finds the first element
635 iterator it = this->find(key);
636 if (it != end()) {
637 do {
638 it = erase(it);
639 count++;
640 } while (it != end() && key_eq()(it->first, key));
641 }
642 return count;
643 }
644
645 /// Remove from this unordered multimap the `value_type` object at the
646 /// specified `position`, and return an iterator referring to the
647 /// element immediately following the removed element, or to the
648 /// past-the-end position if the removed element was the last element in
649 /// the sequence of elements maintained by this unordered multimap.
650 /// This method invalidates only iterators and references to the removed
651 /// element and previously saved values of the `end()` iterator, and
652 /// preserves the relative order of the elements not removed.
653 ///
654 /// \pre The behavior is undefined unless `position` refers to a `value_type`
655 /// object in this unordered multimap.
656 iterator erase(const_iterator position);
657 iterator erase(iterator position);
658
659 /// Remove from this unordered multimap the `value_type` objects
660 /// starting at the specified `first` position up to, but not including,
661 /// the specified `last` position, and return `last`. This method
662 /// invalidates only iterators and references to the removed element and
663 /// previously saved values of the `end()` iterator, and preserves the
664 /// relative order of the elements not removed.
665 ///
666 /// \pre The behavior is undefined unless `first` and `last` either refer to elements in this
667 /// unordered multimap or are the `end` iterator, and the `first`
668 /// position is at or before the `last` position in the sequence
669 /// provided by this container.
671
672 /// Return an iterator providing modifiable access to the first
673 /// `value_type` object in the sequence of all the `value_type` objects
674 /// of this unordered multimap with a key equivalent to the specified
675 /// `key`, if such entries exist, and the past-the-end (`end`) iterator otherwise.
676 ///
677 /// \pre The behavior is undefined unless `key` is equivalent to
678 /// the key of the elements of at most one equivalent-key group in this
679 /// unordered multimap.
680 template <class LOOKUP_KEY>
681 typename enable_if<
682 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
683 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
684 iterator>::type
685 find(const LOOKUP_KEY& key)
686 {
687 // Note: implemented inline due to Sun CC compilation error.
688 return iterator(d_impl.find(key));
689 }
690
691 /// Return an iterator providing modifiable access to the first
692 /// `value_type` object in the sequence of all the `value_type` objects
693 /// of this unordered multimap with a key equivalent to the specified
694 /// `key`, if such entries exist, and the past-the-end (`end`) iterator
695 /// otherwise.
696 iterator find(const key_type& key);
697
698 /// Insert the specified `value` into this unordered multimap, and
699 /// return an iterator referring to the newly inserted `value_type`
700 /// object. This method requires that the (template parameter) types
701 /// `KEY` and `VALUE` both be `copy-insertable` into this unordered
702 /// multimap (see {Requirements on `KEY` and `VALUE`}).
703 iterator insert(const value_type& value);
704
705#if defined(BSLS_PLATFORM_CMP_SUN) && BSLS_PLATFORM_CMP_VERSION < 0x5130
706 template <class ALT_VALUE_TYPE>
708#elif !defined(BSLS_COMPILERFEATURES_SUPPORT_TRAITS_HEADER)
709 template <class ALT_VALUE_TYPE>
710 typename enable_if<is_convertible<ALT_VALUE_TYPE, value_type>::value,
711 iterator>::type
712#else
713 /// Insert into this unordered multimap a `value_type` object created
714 /// from the specified `value`, and return an iterator referring to the
715 /// newly inserted `value_type` object. This method requires that the
716 /// (template parameter) types `KEY` and `VALUE` both be
717 /// `move-insertable` into this unordered multimap (see {Requirements on
718 /// `KEY` and `VALUE`}), and the `value_type` be constructible from the
719 /// (template parameter) `ALT_VALUE_TYPE`.
720 template <class ALT_VALUE_TYPE>
721 typename enable_if<std::is_constructible<value_type,
722 ALT_VALUE_TYPE&&>::value,
723 iterator>::type
724#endif
725 insert(BSLS_COMPILERFEATURES_FORWARD_REF(ALT_VALUE_TYPE) value)
726 {
727 // Note that some compilers fail when this method is defined
728 // out-of-line.
729
730 return emplace(BSLS_COMPILERFEATURES_FORWARD(ALT_VALUE_TYPE, value));
731 }
732
733 /// Insert the specified `value` into this unordered multimap (in
734 /// constant time if the specified `hint` refers to an element in this
735 /// container with a key equivalent to the key of `value`), and return
736 /// an iterator referring to the newly inserted `value_type` object. If
737 /// `hint` does not refer to an element in this container with a key
738 /// equivalent to the key of `value`, this operation has worst case
739 /// `O[N]` and average case constant-time complexity, where `N` is the
740 /// size of this unordered multimap. This method requires that the
741 /// (template parameter) types `KEY` and `VALUE` both be
742 /// `copy-insertable` into this unordered multimap (see {Requirements on `KEY` and `VALUE`}).
743 ///
744 /// \pre The behavior is undefined unless `hint` is an
745 /// iterator in the range `[begin() .. end()]` (both endpoints
746 /// included).
747 iterator insert(const_iterator hint, const value_type& value);
748
749#if defined(BSLS_PLATFORM_CMP_SUN) && BSLS_PLATFORM_CMP_VERSION < 0x5130
750 template <class ALT_VALUE_TYPE>
752#elif !defined(BSLS_COMPILERFEATURES_SUPPORT_TRAITS_HEADER)
753 template <class ALT_VALUE_TYPE>
754 typename enable_if<is_convertible<ALT_VALUE_TYPE, value_type>::value,
755 iterator>::type
756#else
757 /// Insert into this unordered multimap a `value_type` object created
758 /// from the specified `value` (in constant time if the specified `hint`
759 /// refers to an element in this container with a key equivalent to the
760 /// key of `value`), and return an iterator referring to the newly
761 /// inserted `value_type` object. If `hint` does not refer to an
762 /// element in this container with a key equivalent to the key of
763 /// `value`, this operation has worst case `O[N]` and average case
764 /// constant-time complexity, where `N` is the size of this unordered
765 /// multimap. This method requires that the (template parameter) types
766 /// `KEY` and `VALUE` both be `move-insertable` into this unordered
767 /// multimap (see {Requirements on `KEY` and `VALUE`}), and the
768 /// `value_type` be constructible from the (template parameter) `ALT_VALUE_TYPE`.
769 ///
770 /// \pre The behavior is undefined unless `hint` is an
771 /// iterator in the range `[begin() .. end()]` (both endpoints
772 /// included).
773 template <class ALT_VALUE_TYPE>
774 typename enable_if<std::is_constructible<value_type,
775 ALT_VALUE_TYPE&&>::value,
776 iterator>::type
777#endif
779 BSLS_COMPILERFEATURES_FORWARD_REF(ALT_VALUE_TYPE) value)
780 {
781 // Note that some compilers fail when this method is defined
782 // out-of-line.
783
784 return emplace_hint(hint,
785 BSLS_COMPILERFEATURES_FORWARD(ALT_VALUE_TYPE, value));
786 }
787
788 /// Insert into this unordered multimap the value of each `value_type`
789 /// object in the range starting at the specified `first` iterator and
790 /// ending immediately before the specified `last` iterator. The
791 /// (template parameter) type `INPUT_ITERATOR` shall meet the
792 /// requirements of an input iterator defined in the C++11 standard
793 /// [24.2.3] providing access to values of a type convertible to
794 /// `value_type`, and `value_type` must be `emplace-constructible` from
795 /// `*i` into this unordered multimap, where `i` is a dereferenceable
796 /// iterator in the range `[first .. last)` (see {Requirements on `KEY` and `VALUE`}).
797 ///
798 /// \pre The behavior is undefined unless `first` and `last`
799 /// refer to a sequence of valid values where `first` is at a position
800 /// at or before `last`.
801 template <class INPUT_ITERATOR>
802 void insert(INPUT_ITERATOR first, INPUT_ITERATOR last);
803
804 /// Insert into this unordered multimap the value of each `value_type` object in the specified `range`.
805 ///
806 /// \note Note that `RANGE` must meet the
807 /// requirements of an input range and the values from `range` must have
808 /// a type matching or convertible to `value_type`.
809 template <class RANGE>
812 void insert_range(BSLS_COMPILERFEATURES_FORWARD_REF(RANGE) range)
813 {
814 // Defined inline to avoid `clang` and Windows errors.
815#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
816 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
817 if constexpr (ranges::sized_range<RANGE>) {
818 insertFromRange(bsl::ranges::begin(range),
819 bsl::ranges::end (range),
820 bsl::ranges::size (range));
821 } else // ...
822#endif
823 {
824 insertFromRange(bsl::ranges::begin(range),
825 bsl::ranges::end (range));
826 }
827 }
828
829#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
830 /// Insert into this unordered multimap the value of each `value_type`
831 /// object in the specified `values` initializer list. This method
832 /// requires that the (template parameter) types `KEY` and `VALUE` both
833 /// be `copy-insertable` into this unordered multimap (see {Requirements
834 /// on `KEY` and `VALUE`}).
835 void insert(std::initializer_list<value_type> values);
836#endif
837
838#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
839// {{{ BEGIN GENERATED CODE
840// Command line: sim_cpp11_features.pl bslstl_unorderedmultimap.h
841#ifndef BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT
842#define BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT 2
843#endif
844#ifndef BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_A
845#define BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_A BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT
846#endif
847
848#if BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_A >= 0
850#endif // BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_A >= 0
851
852#if BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_A >= 1
853 template <class Args_1>
855#endif // BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_A >= 1
856
857#if BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_A >= 2
858 template <class Args_1,
859 class Args_2>
861 BSLS_COMPILERFEATURES_FORWARD_REF(Args_2) args_2);
862#endif // BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_A >= 2
863
864
865#if BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_A >= 0
867#endif // BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_A >= 0
868
869#if BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_A >= 1
870 template <class Args_1>
872 BSLS_COMPILERFEATURES_FORWARD_REF(Args_1) args_1);
873#endif // BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_A >= 1
874
875#if BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_A >= 2
876 template <class Args_1,
877 class Args_2>
880 BSLS_COMPILERFEATURES_FORWARD_REF(Args_2) args_2);
881#endif // BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_A >= 2
882
883#else
884// The generated code below is a workaround for the absence of perfect
885// forwarding in some compilers.
886
887 template <class... Args>
889
890 template <class... Args>
893
894// }}} END GENERATED CODE
895#endif
896
897 /// Set the maximum load factor of this container to the specified
898 /// `newLoadFactor`.
899 void max_load_factor(float newLoadFactor);
900
901 /// Change the size of the array of buckets maintained by this container
902 /// to the specified `numBuckets`, and redistribute all the contained
903 /// elements into the new sequence of buckets, according to their hash values.
904 ///
905 /// \note Note that this operation has no effect if rehashing the
906 /// elements into `numBuckets` would cause this unordered multimap to
907 /// exceed its @ref max_load_factor .
908 void rehash(size_type numBuckets);
909
910 /// Increase the number of buckets of this unordered multimap to a
911 /// quantity such that the ratio between the specified `numElements` and
912 /// the new number of buckets does not exceed @ref max_load_factor .
913 ///
914 /// \note Note that this guarantees that, after the reserve, elements can be
915 /// inserted to grow the container to `size() == numElements` without
916 /// rehashing. Also note that memory allocations may still occur when
917 /// growing the container to `size() == numElements`. Also note that
918 /// this operation has no effect if `numElements <= size()`.
919 void reserve(size_type numElements);
920
921 // Exchange the value, hasher, key-equality functor, and
922 // @ref max_load_factor of this object with those of the specified `other`
923 // object; also exchange the allocator of this object with that of
924 // `other` if the (template parameter) type `ALLOCATOR` has the
925 // @ref propagate_on_container_swap trait, and do not modify either
926 // allocator otherwise. This method provides the no-throw
927 // exception-safety guarantee if and only if both the (template
928 // parameter) types `HASH` and `EQUAL` provide no-throw swap
929 // operations; if an exception is thrown, both objects are left in
930 // valid but unspecified states. This operation guarantees `O[1]`
931 // complexity. The behavior is undefined unless either this object was
932 // created with the same allocator as `other` or `ALLOCATOR` has the
933 // @ref propagate_on_container_swap trait.
935 AllocatorTraits::is_always_equal::value &&
936 bsl::is_nothrow_swappable<HASH>::value &&
937 bsl::is_nothrow_swappable<EQUAL>::value);
938
939 // ACCESSORS
940
941 /// Return (a copy of) the allocator used for memory allocation by this
942 /// unordered multimap.
944
946
947 /// Return an iterator providing non-modifiable access to the first
948 /// `value_type` object in the sequence of `value_type` objects
949 /// maintained by this unordered multimap, or the `end` iterator if this
950 /// unordered multimap is empty.
952
954
955 /// Return an iterator providing non-modifiable access to the
956 /// past-the-end position in the sequence of `value_type` objects
957 /// maintained by this unordered multimap.
959
960 /// Return `true` if this unordered map contains an element whose key is
961 /// equivalent to the specified `key`.
962 bool contains(const key_type &key) const;
963
964 /// Return `true` if this unordered map contains an element whose key is
965 /// equivalent to the specified `key`.
966 template <class LOOKUP_KEY>
967 typename enable_if<
968 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value &&
969 BloombergLP::bslmf::IsTransparentPredicate<EQUAL,
970 LOOKUP_KEY>::value,
971 bool>::type
972 contains(const LOOKUP_KEY& key) const
973 {
974 // Note: implemented inline due to Sun CC compilation error
975 return find(key) != end();
976 }
977
978 /// Return `true` if this unordered multimap contains no elements, and
979 /// `false` otherwise.
980 bool empty() const BSLS_KEYWORD_NOEXCEPT;
981
982 /// Return the number of elements in this unordered multimap.
984
985 /// Return a theoretical upper bound on the largest number of elements that this unordered multimap could possibly hold.
986 ///
987 /// \note Note that there
988 /// is no guarantee that the unordered multimap can successfully grow to
989 /// the returned size, or even close to that size without running out of
990 /// resources.
992
993 /// Return (a copy of) the key-equivalence binary functor that returns
994 /// `true` if the value of two `key_type` objects are equivalent, and
995 /// `false` otherwise.
996 EQUAL key_eq() const;
997
998 /// Return (a copy of) the hash unary functor used by this unordered
999 /// multimap to generate a hash value (of type `size_type`) for a
1000 /// `key_type` object.
1001 HASH hash_function() const;
1002
1003 /// Return an iterator providing modifiable access to the first
1004 /// `value_type` object in this unordered multimap whose key is
1005 /// equivalent to the specified `key`, if such an entry exists, and the
1006 /// past-the-end (`end`) iterator otherwise.
1007 ///
1008 /// \pre The behavior is undefined unless `key` is equivalent to the key of the elements of at most one
1009 /// equivalent-key group in this unordered multimap.
1010 template <class LOOKUP_KEY>
1011 typename enable_if<
1012 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1013 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1014 const_iterator>::type
1015 find(const LOOKUP_KEY& key) const
1016 {
1017 // Note: implemented inline due to Sun CC compilation error.
1018 return const_iterator(d_impl.find(key));
1019 }
1020
1021 /// Return an iterator providing non-modifiable access to the first
1022 /// `value_type` object in the sequence of `value_type` objects of this
1023 /// unordered multimap with a key equivalent to the specified `key`, if
1024 /// such entries exist, and the past-the-end (`end`) iterator otherwise.
1025 const_iterator find(const key_type& key) const;
1026
1027 /// Return the number of `value_type` objects in this unordered multimap
1028 /// with a key equivalent to the specified `key`.
1029 ///
1030 /// \pre The behavior is undefined unless `key` is equivalent to the key of the elements of
1031 /// at most one equivalent-key group in this unordered multimap.
1032 template <class LOOKUP_KEY>
1033 typename enable_if<
1034 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1035 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1036 size_type>::type
1037 count(const LOOKUP_KEY& key) const
1038 {
1039 // Note: implemented inline due to Sun CC compilation error.
1040 typedef ::BloombergLP::bslalg::BidirectionalNode<value_type> BNode;
1041
1042 size_type result = 0;
1043 for (HashTableLink *cursor = d_impl.find(key);
1044 cursor;
1045 ++result, cursor = cursor->nextLink())
1046 {
1047 BNode *cursorNode = static_cast<BNode *>(cursor);
1048 if (!this->key_eq()(
1049 key,
1050 ListConfiguration::extractKey(cursorNode->value()))) {
1051
1052 break;
1053 }
1054 }
1055 return result;
1056 }
1057
1058 /// Return the number of `value_type` objects in this unordered multimap
1059 /// with a key equivalent to the specified `key`.
1060 size_type count(const key_type& key) const;
1061
1062 /// Return a pair of iterators providing non-modifiable access to the
1063 /// sequence of `value_type` objects in this unordered multimap with a
1064 /// key equivalent to the specified `key`, where the first iterator is
1065 /// positioned at the start of the sequence, and the second is
1066 /// positioned one past the end of the sequence. If this unordered
1067 /// multimap contains no `value_type` objects with a key equivalent to
1068 /// `key`, then the two returned iterators will have the same value.
1069 ///
1070 /// \pre The behavior is undefined unless `key` is equivalent to the key of
1071 /// the elements of at most one equivalent-key group in this unordered
1072 /// multimap.
1073 template <class LOOKUP_KEY>
1074 typename enable_if<
1075 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1076 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1077 pair<const_iterator, const_iterator> >::type
1078 equal_range(const LOOKUP_KEY& key) const
1079 {
1080 // Note: implemented inline due to Sun CC compilation error.
1082 HashTableLink *first;
1083 HashTableLink *last;
1084 d_impl.findRange(&first, &last, key);
1085 return ResultType(const_iterator(first), const_iterator(last));
1086 }
1087
1088 /// Return a pair of iterators providing non-modifiable access to the
1089 /// sequence of `value_type` objects in this unordered multimap with a
1090 /// key equivalent to the specified `key`, where the first iterator is
1091 /// positioned at the start of the sequence, and the second is
1092 /// positioned one past the end of the sequence. If this unordered
1093 /// multimap contains no `value_type` objects with a key equivalent to
1094 /// `key`, then the two returned iterators will have the same value.
1095 pair<const_iterator, const_iterator> equal_range(
1096 const key_type& key) const;
1097
1099
1100 /// Return a local iterator providing non-modifiable access to the first
1101 /// `value_type` object (in the sequence of `value_type` objects) of the
1102 /// bucket having the specified `index` in the array of buckets
1103 /// maintained by this unordered multimap, or the `end(index)` iterator if the indexed bucket is empty.
1104 ///
1105 /// \pre The behavior is undefined unless
1106 /// `index < bucket_count()`.
1108
1109 const_local_iterator end(size_type index) const;
1110
1111 /// Return a local iterator providing non-modifiable access to the
1112 /// past-the-end position (in the sequence of `value_type` objects) of
1113 /// the bucket having the specified `index` in the array of buckets
1114 /// maintained by this unordered multimap.
1115 ///
1116 /// \pre The behavior is undefined unless `index < bucket_count()`.
1117 const_local_iterator cend(size_type index) const;
1118
1119 /// Return the index of the bucket, in the array of buckets of this
1120 /// container, where a value with a key equivalent to the specified
1121 /// `key` would be inserted.
1122 size_type bucket(const key_type& key) const;
1123
1124 /// Return the index of the bucket, in the array of buckets maintained
1125 /// by this unordered map, where values having a key equivalent to the
1126 /// specified `key` would be inserted.
1127 ///
1128 /// Note: implemented inline due to Sun CC compilation error.
1129 template <class LOOKUP_KEY>
1130 typename enable_if<
1131 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1132 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1133 size_type>::type
1134 bucket(const LOOKUP_KEY& key) const
1135 {
1136 return d_impl.bucketIndexForKey(key);
1137 }
1138
1139 /// Return the number of buckets in the array of buckets maintained by
1140 /// this unordered multimap.
1142
1143 /// Return a theoretical upper bound on the largest number of buckets that this container could possibly manage.
1144 ///
1145 /// \note Note that there is no
1146 /// guarantee that the unordered multimap can successfully grow to the
1147 /// returned size, or even close to that size without running out of
1148 /// resources.
1150
1151 /// Return the number of elements contained in the bucket at the
1152 /// specified `index` in the array of buckets maintained by this container.
1153 ///
1154 /// \pre The behavior is undefined unless
1155 /// `index < bucket_count()`.
1156 size_type bucket_size(size_type index) const;
1157
1158 /// Return the current ratio between the `size` of this container and
1159 /// the number of buckets. The load factor is a measure of how full the
1160 /// container is, and a higher load factor typically leads to an
1161 /// increased number of collisions, thus resulting in a loss of
1162 /// performance.
1163 float load_factor() const BSLS_KEYWORD_NOEXCEPT;
1164
1165 /// Return the maximum load factor allowed for this container.
1166 ///
1167 /// \note Note that if an insert operation would cause the load factor to exceed
1168 /// the @ref max_load_factor , that same insert operation will increase the
1169 /// number of buckets and rehash the elements of the container into
1170 /// those buckets (see `rehash`).
1172
1173 private:
1174 // PRIVATE MANIPULATORS
1175
1176 /// Create an empty unordered multimap, and insert each `value_type`
1177 /// object in the range starting at the specified `first` iterator and
1178 /// ending immediately before the specified `last` sentinel. Optionally
1179 /// specify the initial `numElements` size of the unordered multimap.
1180 /// Note: this method is intended for internal use only.
1181 template <class INPUT_ITERATOR, class SENTINEL>
1182 void constructFromRange(INPUT_ITERATOR first, SENTINEL last);
1183
1184#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
1185 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
1186 template <class INPUT_ITERATOR, class SENTINEL>
1187 void constructFromRange(INPUT_ITERATOR first,
1188 SENTINEL last,
1189 size_t numElements);
1190#endif
1191
1192 /// Insert into this unordered multimap the value of each `value_type`
1193 /// object in the range starting at the specified `first` iterator and
1194 /// ending immediately before the specified `last` sentinel. Optionally
1195 /// specify the initial `numElements` size of the range. Note: this
1196 /// method is intended for internal use only.
1197 template <class INPUT_ITERATOR, class SENTINEL>
1198 void insertFromRange(INPUT_ITERATOR first, SENTINEL last);
1199
1200#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
1201 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
1202 template <class INPUT_ITERATOR, class SENTINEL>
1203 void insertFromRange(INPUT_ITERATOR first,
1204 SENTINEL last,
1205 size_t numElements);
1206#endif
1207};
1208
1209#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1210// CLASS TEMPLATE DEDUCTION GUIDES
1211
1212/// Deduce the template parameters `KEY` and `VALUE` from the `value_type`
1213/// of the iterators supplied to the constructor of @ref unordered_multimap .
1214/// Deduce the template parameters `HASH`, `EQUAL` and `ALLOCATOR` from the
1215/// other parameters passed to the constructor of @ref unordered_multimap .
1216/// This deduction guide does not participate unless the supplied allocator
1217/// meets the requirements of a standard allocator.
1218template <
1219 class INPUT_ITERATOR,
1220 class KEY = BloombergLP::bslstl::IteratorUtil::IterKey_t<INPUT_ITERATOR>,
1221 class VALUE =
1222 BloombergLP::bslstl::IteratorUtil::IterMapped_t<INPUT_ITERATOR>,
1223 class HASH = bsl::hash<KEY>,
1224 class EQUAL = bsl::equal_to<KEY>,
1225 class ALLOCATOR = bsl::allocator<pair<const KEY, VALUE>>,
1226 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
1227 class = bsl::enable_if_t<
1228 std::is_invocable_v<EQUAL, const KEY &, const KEY &>>,
1229 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1230 >
1231unordered_multimap(INPUT_ITERATOR,
1232 INPUT_ITERATOR,
1233 typename bsl::allocator_traits<ALLOCATOR>::size_type = 0,
1234 HASH = HASH(),
1235 EQUAL = EQUAL(),
1236 ALLOCATOR = ALLOCATOR())
1237-> unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>;
1238
1239/// Deduce the template parameters `KEY` and `VALUE` from the `value_type`
1240/// of the iterators supplied to the constructor of @ref unordered_multimap .
1241/// Deduce the template parameters `HASH` and "EQUAL' from the other
1242/// parameters passed to the constructor of @ref unordered_multimap . This
1243/// deduction guide does not participate unless the supplied allocator is
1244/// convertible to `bsl::allocator<bsl::pair<const KEY, VALUE>>`.
1245template <
1246 class INPUT_ITERATOR,
1247 class HASH,
1248 class EQUAL,
1249 class ALLOC,
1250 class KEY = BloombergLP::bslstl::IteratorUtil::IterKey_t<INPUT_ITERATOR>,
1251 class VALUE =
1252 BloombergLP::bslstl::IteratorUtil::IterMapped_t<INPUT_ITERATOR>,
1253 class DEFAULT_ALLOCATOR = bsl::allocator<pair<const KEY, VALUE>>,
1254 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1255 >
1256unordered_multimap(
1257 INPUT_ITERATOR,
1258 INPUT_ITERATOR,
1259 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1260 HASH,
1261 EQUAL,
1262 ALLOC *)
1263-> unordered_multimap<KEY, VALUE, HASH, EQUAL>;
1264
1265/// Deduce the template parameters `KEY` and `VALUE` from the `value_type`
1266/// of the iterators supplied to the constructor of @ref unordered_multimap .
1267/// Deduce the template parameters `HASH` and `ALLOCATOR` from the other
1268/// parameters passed to the constructor of @ref unordered_multimap . This
1269/// deduction guide does not participate unless the supplied hash is
1270/// invokable with a `KEY`, and the supplied allocator meets the
1271/// requirements of a standard allocator.
1272template <
1273 class INPUT_ITERATOR,
1274 class HASH,
1275 class ALLOCATOR,
1276 class KEY = BloombergLP::bslstl::IteratorUtil::IterKey_t<INPUT_ITERATOR>,
1277 class VALUE =
1278 BloombergLP::bslstl::IteratorUtil::IterMapped_t<INPUT_ITERATOR>,
1279 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
1280 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1281 >
1282unordered_multimap(INPUT_ITERATOR,
1283 INPUT_ITERATOR,
1284 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1285 HASH,
1286 ALLOCATOR)
1287-> unordered_multimap<KEY, VALUE, HASH, bsl::equal_to<KEY>, ALLOCATOR>;
1288
1289/// Deduce the template parameters `KEY` and `VALUE` from the `value_type`
1290/// of the iterators supplied to the constructor of @ref unordered_multimap .
1291/// Deduce the template parameter `HASH` from the other parameters passed to
1292/// the constructor of @ref unordered_multimap . This deduction guide does not
1293/// participate unless the supplied allocator is convertible to
1294/// `bsl::allocator<bsl::pair<const KEY, VALUE>>`.
1295template <
1296 class INPUT_ITERATOR,
1297 class HASH,
1298 class ALLOC,
1299 class KEY = BloombergLP::bslstl::IteratorUtil::IterKey_t<INPUT_ITERATOR>,
1300 class VALUE =
1301 BloombergLP::bslstl::IteratorUtil::IterMapped_t<INPUT_ITERATOR>,
1302 class DEFAULT_ALLOCATOR = bsl::allocator<bsl::pair<const KEY, VALUE>>,
1303 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1304 >
1305unordered_multimap(
1306 INPUT_ITERATOR,
1307 INPUT_ITERATOR,
1308 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1309 HASH,
1310 ALLOC *)
1311-> unordered_multimap<KEY, VALUE, HASH>;
1312
1313/// Deduce the template parameters `KEY` and `VALUE` from the `value_type`
1314/// of the iterators supplied to the constructor of @ref unordered_multimap .
1315/// This deduction guide does not participate unless the supplied allocator
1316/// meets the requirements of a standard allocator.
1317template <
1318 class INPUT_ITERATOR,
1319 class ALLOCATOR,
1320 class KEY = BloombergLP::bslstl::IteratorUtil::IterKey_t<INPUT_ITERATOR>,
1321 class VALUE =
1322 BloombergLP::bslstl::IteratorUtil::IterMapped_t<INPUT_ITERATOR>,
1323 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1324 >
1325unordered_multimap(INPUT_ITERATOR,
1326 INPUT_ITERATOR,
1327 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1328 ALLOCATOR)
1329-> unordered_multimap<KEY,
1330 VALUE,
1331 bsl::hash<KEY>,
1332 bsl::equal_to<KEY>,
1333 ALLOCATOR>;
1334
1335/// of the iterators supplied to the constructor of @ref unordered_multimap .
1336/// Deduce the template parameter `ALLOCATOR` from the other parameter
1337/// passed to the constructor of @ref unordered_multimap . This deduction guide
1338/// does not participate unless the supplied allocator meets the
1339/// requirements of a standard allocator.
1340template <
1341 class INPUT_ITERATOR,
1342 class ALLOC,
1343 class KEY = BloombergLP::bslstl::IteratorUtil::IterKey_t<INPUT_ITERATOR>,
1344 class VALUE =
1345 BloombergLP::bslstl::IteratorUtil::IterMapped_t<INPUT_ITERATOR>,
1346 class DEFAULT_ALLOCATOR = bsl::allocator<bsl::pair<const KEY, VALUE>>,
1347 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1348 >
1349unordered_multimap(
1350 INPUT_ITERATOR,
1351 INPUT_ITERATOR,
1352 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1353 ALLOC *)
1354-> unordered_multimap<KEY, VALUE>;
1355
1356/// Deduce the template parameters `KEY` and `VALUE` from the `value_type`
1357/// of the iterators supplied to the constructor of @ref unordered_multimap .
1358/// Deduce the template parameter `ALLOCATOR` from the other parameter
1359/// passed to the constructor of @ref unordered_multimap . This deduction guide
1360/// does not participate unless the supplied allocator meets the
1361/// requirements of a standard allocator.
1362template <
1363 class INPUT_ITERATOR,
1364 class ALLOCATOR,
1365 class KEY = BloombergLP::bslstl::IteratorUtil::IterKey_t<INPUT_ITERATOR>,
1366 class VALUE =
1367 BloombergLP::bslstl::IteratorUtil::IterMapped_t<INPUT_ITERATOR>,
1368 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1369 >
1370unordered_multimap(INPUT_ITERATOR, INPUT_ITERATOR, ALLOCATOR)
1371-> unordered_multimap<KEY,
1372 VALUE,
1373 bsl::hash<KEY>,
1374 bsl::equal_to<KEY>,
1375 ALLOCATOR>;
1376
1377/// Deduce the template parameters `KEY` and `VALUE` from the `value_type`
1378/// of the iterators supplied to the constructor of @ref unordered_multimap .
1379/// This deduction guide does not participate unless the supplied allocator
1380/// is convertible to `bsl::allocator<bsl::pair<const KEY, VALUE>>`.
1381template <
1382 class INPUT_ITERATOR,
1383 class ALLOC,
1384 class KEY = BloombergLP::bslstl::IteratorUtil::IterKey_t<INPUT_ITERATOR>,
1385 class VALUE =
1386 BloombergLP::bslstl::IteratorUtil::IterMapped_t<INPUT_ITERATOR>,
1387 class DEFAULT_ALLOCATOR = bsl::allocator<bsl::pair<const KEY, VALUE>>,
1388 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1389 >
1390unordered_multimap(INPUT_ITERATOR, INPUT_ITERATOR, ALLOC *)
1391-> unordered_multimap<KEY, VALUE>;
1392
1393/// Deduce the template parameters `KEY` and `VALUE` from the `value_type`
1394/// of the initializer_list supplied to the constructor of
1395/// @ref unordered_multimap . Deduce the template parameters `HASH`, `EQUAL`
1396/// and `ALLOCATOR` from the other parameters supplied to the constructor of
1397/// @ref unordered_multimap . This deduction guide does not participate unless:
1398/// (1) the supplied `HASH` is invokable with a `KEY`, (2) the supplied
1399/// `EQUAL` is invokable with two `KEY`s, and (3) the supplied allocator
1400/// meets the requirements of a standard allocator.
1401template <
1402 class KEY,
1403 class VALUE,
1404 class HASH = bsl::hash<KEY>,
1405 class EQUAL = bsl::equal_to<KEY>,
1406 class ALLOCATOR = bsl::allocator<bsl::pair<const KEY, VALUE>>,
1407 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
1408 class = bsl::enable_if_t<
1409 std::is_invocable_v<EQUAL, const KEY &, const KEY &>>,
1410 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1411 >
1412unordered_multimap(std::initializer_list<bsl::pair<const KEY, VALUE>>,
1413 typename bsl::allocator_traits<ALLOCATOR>::size_type = 0,
1414 HASH = HASH(),
1415 EQUAL = EQUAL(),
1416 ALLOCATOR = ALLOCATOR())
1417-> unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>;
1418
1419/// Deduce the template parameters `KEY` and `VALUE` from the `value_type`
1420/// of the initializer_list supplied to the constructor of
1421/// @ref unordered_multimap . Deduce the template parameters `HASH`, `EQUAL`
1422/// and `ALLOCATOR` from the other parameters supplied to the constructor of
1423/// @ref unordered_multimap . This deduction guide does not participate unless
1424/// the supplied allocator is convertible to
1425/// `bsl::allocator<bsl::pair<const KEY, VALUE>>`.
1426template <
1427 class KEY,
1428 class VALUE,
1429 class HASH,
1430 class EQUAL,
1431 class ALLOC,
1432 class DEFAULT_ALLOCATOR = bsl::allocator<bsl::pair<const KEY, VALUE>>,
1433 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1434 >
1435unordered_multimap(
1436 std::initializer_list<bsl::pair<const KEY, VALUE>>,
1437 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1438 HASH,
1439 EQUAL,
1440 ALLOC *)
1441-> unordered_multimap<KEY, VALUE, HASH, EQUAL>;
1442
1443/// Deduce the template parameters `KEY` and `VALUE` from the `value_type`
1444/// of the initializer_list supplied to the constructor of
1445/// @ref unordered_multimap . Deduce the template parameters `HASH` and
1446/// `ALLOCATOR` from the other parameters supplied to the constructor of
1447/// @ref unordered_multimap . This deduction guide does not participate unless
1448/// the supplied `HASH` is invokable with a `KEY`, and the supplied
1449/// allocator meets the requirements of a standard allocator.
1450template <
1451 class KEY,
1452 class VALUE,
1453 class HASH,
1454 class ALLOCATOR,
1455 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
1456 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1457 >
1458unordered_multimap(std::initializer_list<bsl::pair<const KEY, VALUE>>,
1459 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1460 HASH,
1461 ALLOCATOR)
1462-> unordered_multimap<KEY, VALUE, HASH, bsl::equal_to<KEY>, ALLOCATOR>;
1463
1464/// Deduce the template parameters `KEY` and `VALUE` from the `value_type`
1465/// of the initializer_list supplied to the constructor of
1466/// @ref unordered_multimap . Deduce the template parameter `HASH` from the
1467/// other parameters supplied to the constructor of @ref unordered_multimap .
1468/// This deduction guide does not participate unless the supplied allocator
1469/// is convertible to `bsl::allocator<bsl::pair<const KEY, VALUE>>`.
1470template <
1471 class KEY,
1472 class VALUE,
1473 class HASH,
1474 class ALLOC,
1475 class DEFAULT_ALLOCATOR = bsl::allocator<bsl::pair<const KEY, VALUE>>,
1476 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1477 >
1478unordered_multimap(
1479 std::initializer_list<bsl::pair<const KEY, VALUE>>,
1480 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1481 HASH,
1482 ALLOC *)
1483-> unordered_multimap<KEY, VALUE, HASH>;
1484
1485/// Deduce the template parameters `KEY` and `VALUE` from the `value_type`
1486/// of the initializer_list supplied to the constructor of
1487/// @ref unordered_multimap . This deduction guide does not participate unless
1488/// the supplied allocator meets the requirements of a standard allocator.
1489template <
1490 class KEY,
1491 class VALUE,
1492 class ALLOCATOR,
1493 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1494 >
1495unordered_multimap(std::initializer_list<bsl::pair<const KEY, VALUE>>,
1496 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1497 ALLOCATOR)
1498-> unordered_multimap<KEY,
1499 VALUE,
1500 bsl::hash<KEY>,
1501 bsl::equal_to<KEY>,
1502 ALLOCATOR>;
1503
1504/// Deduce the template parameters `KEY` and `VALUE` from the `value_type`
1505/// of the initializer_list supplied to the constructor of
1506/// @ref unordered_multimap . This deduction guide does not participate unless
1507/// the supplied allocator is convertible to
1508/// `bsl::allocator<bsl::pair<const KEY, VALUE>>`.
1509template <
1510 class KEY,
1511 class VALUE,
1512 class ALLOC,
1513 class DEFAULT_ALLOCATOR = bsl::allocator<bsl::pair<const KEY, VALUE>>,
1514 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1515 >
1516unordered_multimap(
1517 std::initializer_list<bsl::pair<const KEY, VALUE>>,
1518 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1519 ALLOC *)
1520-> unordered_multimap<KEY, VALUE>;
1521
1522/// Deduce the template parameters `KEY` and `VALUE` from the `value_type`
1523/// of the initializer_list supplied to the constructor of
1524/// @ref unordered_multimap . Deduce the template parameter `ALLOCATOR` from
1525/// the other parameters supplied to the constructor of
1526/// @ref unordered_multimap . This deduction guide does not participate unless
1527/// the supplied allocator meets the requirements of a standard allocator.
1528template <
1529 class KEY,
1530 class VALUE,
1531 class ALLOCATOR,
1532 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1533 >
1534unordered_multimap(std::initializer_list<bsl::pair<const KEY, VALUE>>,
1535 ALLOCATOR)
1536-> unordered_multimap<KEY,
1537 VALUE,
1538 bsl::hash<KEY>,
1539 bsl::equal_to<KEY>,
1540 ALLOCATOR>;
1541
1542/// Deduce the template parameters `KEY` and `VALUE` from the `value_type`
1543/// of the initializer_list supplied to the constructor of
1544/// @ref unordered_multimap . This deduction guide does not participate unless
1545/// the supplied allocator is convertible to
1546/// `bsl::allocator<bsl::pair<const KEY, VALUE>>`.
1547template <
1548 class KEY,
1549 class VALUE,
1550 class ALLOC,
1551 class DEFAULT_ALLOCATOR = bsl::allocator<bsl::pair<const KEY, VALUE>>,
1552 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1553 >
1554unordered_multimap(std::initializer_list<bsl::pair<const KEY, VALUE>>, ALLOC *)
1555-> unordered_multimap<KEY, VALUE>;
1556#endif
1557
1558// FREE OPERATORS
1559
1560/// Return `true` if the specified `lhs` and `rhs` objects have the same
1561/// value, and `false` otherwise. Two @ref unordered_multimap objects have the
1562/// same value if they have the same number of key-value pairs, and each
1563/// key-value pair that is contained in one of the objects is also contained
1564/// in the other object. This method requires that the (template parameter)
1565/// types `KEY` and `VALUE` both be `equality-comparable` (see {Requirements
1566/// on `KEY` and `VALUE`}).
1567template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1568bool operator==(
1569 const unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>& lhs,
1570 const unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>& rhs);
1571
1572#ifndef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
1573template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1574bool operator!=(
1575 const unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>& lhs,
1576 const unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>& rhs);
1577 // Return 'true' if the specified 'lhs' and 'rhs' objects do not have the
1578 // same value, and 'false' otherwise. Two @ref unordered_multimap objects do
1579 // not have the same value if they do not have the same number of key-value
1580 // pairs, or some key-value pair that is contained in one of the objects is
1581 // not also contained in the other object. This method requires that the
1582 // (template parameter) types 'KEY' and 'VALUE' both be
1583 // 'equality-comparable' (see {Requirements on 'KEY' and 'VALUE'}).
1584#endif
1585
1586// FREE FUNCTIONS
1587
1588/// Erase all the elements in the specified unordered_multimap `m` that satisfy
1589/// the specified predicate `predicate`. Return the number of elements
1590/// erased.
1591template <class KEY,
1592 class VALUE,
1593 class HASH,
1594 class EQUAL,
1595 class ALLOCATOR,
1596 class PREDICATE>
1597typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::size_type
1598erase_if(unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>& m,
1599 PREDICATE predicate);
1600
1601/// Exchange the value, hasher, key-equality functor, and @ref max_load_factor
1602/// of the specified `a` object with those of the specified `b` object; also
1603/// exchange the allocator of `a` with that of `b` if the (template
1604/// parameter) type `ALLOCATOR` has the @ref propagate_on_container_swap trait,
1605/// and do not modify either allocator otherwise. This function provides
1606/// the no-throw exception-safety guarantee if and only if both the
1607/// (template parameter) types `HASH` and `EQUAL` provide no-throw swap
1608/// operations; if an exception is thrown, both objects are left in valid
1609/// but unspecified states. This operation guarantees `O[1]` complexity.
1610///
1611/// \pre The behavior is undefined unless either `a` was created with the same
1612/// allocator as `b` or `ALLOCATOR` has the @ref propagate_on_container_swap
1613/// trait.
1614template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1615void swap(unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>& a,
1616 unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>& b)
1618
1619// ============================================================================
1620// TEMPLATE AND INLINE FUNCTION DEFINITIONS
1621// ============================================================================
1622
1623 //-------------------------
1624 // class unordered_multimap
1625 //-------------------------
1626
1627// PRIVATE MANIPULATORS
1628
1629template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1630template <class INPUT_ITERATOR, class SENTINEL>
1631void unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::
1632 constructFromRange(INPUT_ITERATOR first,
1633 SENTINEL last)
1634{
1635 BSLS_ASSERT_SAFE(this->empty());
1636
1637 const difference_type maxInsertions =
1638 ::BloombergLP::bslstl::IteratorUtil::insertDistance(first, last);
1639 if (0 < maxInsertions) {
1640 this->reserve(maxInsertions);
1641 }
1642 else {
1643 BSLS_ASSERT_SAFE(0 == maxInsertions);
1644 }
1645
1646 while (first != last) {
1647 d_impl.emplace(*first);
1648 ++first;
1649 }
1650}
1651
1652#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
1653 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
1654template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1655template <class INPUT_ITERATOR, class SENTINEL>
1656void unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::
1657 constructFromRange(INPUT_ITERATOR first,
1658 SENTINEL last,
1659 size_t numElements)
1660{
1661 BSLS_ASSERT_SAFE(this->empty());
1662
1663 if (0 < numElements) {
1664 this->reserve(numElements);
1665 }
1666
1667 while (first != last) {
1668 d_impl.emplace(*first);
1669 ++first;
1670 }
1671}
1672#endif
1673
1674template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1675template <class INPUT_ITERATOR, class SENTINEL>
1676void unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::
1677 insertFromRange(INPUT_ITERATOR first,
1678 SENTINEL last)
1679{
1680 const difference_type maxInsertions =
1681 ::BloombergLP::bslstl::IteratorUtil::insertDistance(first, last);
1682 if (0 < maxInsertions) {
1683 this->reserve(this->size() + maxInsertions);
1684 }
1685 else {
1686 BSLS_ASSERT_SAFE(0 == maxInsertions);
1687 }
1688
1689 while (first != last) {
1690 d_impl.emplace(*first);
1691 ++first;
1692 }
1693}
1694
1695#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
1696 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
1697template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1698template <class INPUT_ITERATOR, class SENTINEL>
1699void unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::
1700 insertFromRange(INPUT_ITERATOR first,
1701 SENTINEL last,
1702 size_t numElements)
1703{
1704 if (0 < numElements) {
1705 this->reserve(this->size() + numElements);
1706 }
1707
1708 while (first != last) {
1709 d_impl.emplace(*first);
1710 ++first;
1711 }
1712}
1713#endif
1714
1715// CREATORS
1716template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1717inline
1719: d_impl(HASH(), EQUAL(), 0, 1.0f, ALLOCATOR())
1720{
1721}
1722
1723template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1724inline
1725unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1726 size_type initialNumBuckets,
1727 const HASH& hashFunction,
1728 const EQUAL& keyEqual,
1729 const ALLOCATOR& basicAllocator)
1730: d_impl(hashFunction, keyEqual, initialNumBuckets, 1.0f, basicAllocator)
1731{
1732}
1733
1734template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1735inline
1736unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1737 size_type initialNumBuckets,
1738 const HASH& hashFunction,
1739 const ALLOCATOR& basicAllocator)
1740: d_impl(hashFunction, EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
1741{
1742}
1743
1744template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1745inline
1746unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1747 size_type initialNumBuckets,
1748 const ALLOCATOR& basicAllocator)
1749: d_impl(HASH(), EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
1750{
1751}
1752
1753template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1754inline
1755unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1756 const ALLOCATOR& basicAllocator)
1757: d_impl(basicAllocator)
1758{
1759}
1760
1761template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1762inline
1763unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1764 const unordered_multimap& original)
1765: d_impl(original.d_impl,
1766 AllocatorTraits::select_on_container_copy_construction(
1767 original.get_allocator()))
1768{
1769}
1770
1771template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1772inline
1773unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1774 BloombergLP::bslmf::MovableRef<unordered_multimap> original)
1775: d_impl(MoveUtil::move(MoveUtil::access(original).d_impl))
1776{
1777}
1778
1779template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1780inline
1781unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1782 const unordered_multimap& original,
1783 const typename type_identity<ALLOCATOR>::type& basicAllocator)
1784: d_impl(original.d_impl, basicAllocator)
1785{
1786}
1787
1788template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1789inline
1790unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1791 BloombergLP::bslmf::MovableRef<unordered_multimap> original,
1792 const typename type_identity<ALLOCATOR>::type& basicAllocator)
1793: d_impl(MoveUtil::move(MoveUtil::access(original).d_impl), basicAllocator)
1794{
1795}
1796
1797template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1798template <class INPUT_ITERATOR>
1799inline
1800unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1801 INPUT_ITERATOR first,
1802 INPUT_ITERATOR last,
1803 size_type initialNumBuckets,
1804 const HASH& hashFunction,
1805 const EQUAL& keyEqual,
1806 const ALLOCATOR& basicAllocator)
1807: d_impl(hashFunction, keyEqual, initialNumBuckets, 1.0f, basicAllocator)
1808{
1809 constructFromRange(first, last);
1810}
1811
1812template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1813template <class INPUT_ITERATOR>
1814inline
1815unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1816 INPUT_ITERATOR first,
1817 INPUT_ITERATOR last,
1818 size_type initialNumBuckets,
1819 const HASH& hashFunction,
1820 const ALLOCATOR& basicAllocator)
1821: d_impl(hashFunction, EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
1822{
1823 this->insert(first, last);
1824}
1825
1826template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1827template <class INPUT_ITERATOR>
1828inline
1829unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1830 INPUT_ITERATOR first,
1831 INPUT_ITERATOR last,
1832 size_type initialNumBuckets,
1833 const ALLOCATOR& basicAllocator)
1834: d_impl(HASH(), EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
1835{
1836 this->insert(first, last);
1837}
1838
1839template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1840template <class INPUT_ITERATOR>
1841inline
1842unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1843 INPUT_ITERATOR first,
1844 INPUT_ITERATOR last,
1845 const ALLOCATOR& basicAllocator)
1846: d_impl(HASH(), EQUAL(), 0, 1.0f, basicAllocator)
1847{
1848 this->insert(first, last);
1849}
1850
1851#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1852template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1853# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1854template <class, class, class>
1855# endif
1856inline
1857unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1858 std::initializer_list<value_type> values,
1859 size_type initialNumBuckets,
1860 const HASH& hashFunction,
1861 const EQUAL& keyEqual,
1862 const ALLOCATOR& basicAllocator)
1863: unordered_multimap(values.begin(),
1864 values.end(),
1865 initialNumBuckets,
1866 hashFunction,
1867 keyEqual,
1868 basicAllocator)
1869{
1870}
1871
1872template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1873# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1874template <class, class>
1875# endif
1876inline
1877unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1878 std::initializer_list<value_type> values,
1879 size_type initialNumBuckets,
1880 const HASH& hashFunction,
1881 const ALLOCATOR& basicAllocator)
1882: unordered_multimap(values.begin(),
1883 values.end(),
1884 initialNumBuckets,
1885 hashFunction,
1886 EQUAL(),
1887 basicAllocator)
1888{
1889}
1890
1891template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1892# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1893template <class>
1894# endif
1895inline
1896unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1897 std::initializer_list<value_type> values,
1898 size_type initialNumBuckets,
1899 const ALLOCATOR& basicAllocator)
1900: unordered_multimap(values.begin(),
1901 values.end(),
1902 initialNumBuckets,
1903 HASH(),
1904 EQUAL(),
1905 basicAllocator)
1906{
1907}
1908
1909template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1910# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1911template <class>
1912# endif
1913inline
1914unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::unordered_multimap(
1915 std::initializer_list<value_type> values,
1916 const ALLOCATOR& basicAllocator)
1917: unordered_multimap(values.begin(),
1918 values.end(),
1919 0,
1920 HASH(),
1921 EQUAL(),
1922 basicAllocator)
1923{
1924}
1925#endif // defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1926
1927template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1928unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::~unordered_multimap()
1929{
1930 // All memory management is handled by the base 'd_impl' member.
1931}
1932
1933// MANIPULATORS
1934template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1935unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>&
1936unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::operator=(
1937 const unordered_multimap& rhs)
1938{
1939 // Note that we have delegated responsibility for correct handling of
1940 // allocator propagation to the 'HashTable' implementation.
1941
1942 d_impl = rhs.d_impl;
1943
1944 return *this;
1945}
1946
1947template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1948inline
1949unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>&
1950unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::operator=(
1951 BloombergLP::bslmf::MovableRef<unordered_multimap> rhs)
1953 AllocatorTraits::is_always_equal::value &&
1954 std::is_nothrow_move_assignable<HASH>::value &&
1955 std::is_nothrow_move_assignable<EQUAL>::value)
1956{
1957 // Note that we have delegated responsibility for correct handling of
1958 // allocator propagation to the 'HashTable' implementation.
1959
1960 unordered_multimap& lvalue = rhs;
1961
1962 d_impl = MoveUtil::move(lvalue.d_impl);
1963
1964 return *this;
1965}
1966
1967#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1968template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1969inline
1970unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>&
1971unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::operator=(
1972 std::initializer_list<value_type> values)
1973{
1974 unordered_multimap tmp(values.begin(), values.end(), d_impl.allocator());
1975
1976 d_impl.swap(tmp.d_impl);
1977
1978 return *this;
1979}
1980#endif
1981
1982#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1983// {{{ BEGIN GENERATED CODE
1984// Command line: sim_cpp11_features.pl bslstl_unorderedmultimap.h
1985#ifndef BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT
1986#define BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT 2
1987#endif
1988#ifndef BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_B
1989#define BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_B BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT
1990#endif
1991#if BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_B >= 0
1992template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
1993inline
1994typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
1995unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::emplace(
1996 )
1997{
1998 return iterator(d_impl.emplace(
1999 ));
2000
2001}
2002#endif // BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_B >= 0
2003
2004#if BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_B >= 1
2005template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2006template <class Args_1>
2007inline
2008typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2009unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::emplace(
2010 BSLS_COMPILERFEATURES_FORWARD_REF(Args_1) args_1)
2011{
2012 return iterator(d_impl.emplace(
2013 BSLS_COMPILERFEATURES_FORWARD(Args_1, args_1)));
2014
2015}
2016#endif // BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_B >= 1
2017
2018#if BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_B >= 2
2019template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2020template <class Args_1,
2021 class Args_2>
2022inline
2023typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2024unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::emplace(
2025 BSLS_COMPILERFEATURES_FORWARD_REF(Args_1) args_1,
2026 BSLS_COMPILERFEATURES_FORWARD_REF(Args_2) args_2)
2027{
2028 return iterator(d_impl.emplace(
2029 BSLS_COMPILERFEATURES_FORWARD(Args_1, args_1),
2030 BSLS_COMPILERFEATURES_FORWARD(Args_2, args_2)));
2031
2032}
2033#endif // BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_B >= 2
2034
2035
2036#if BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_B >= 0
2037template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2038inline
2039typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2040unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2041 const_iterator hint)
2042{
2043 return iterator(d_impl.emplaceWithHint(hint.node()));
2044}
2045#endif // BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_B >= 0
2046
2047#if BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_B >= 1
2048template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2049template <class Args_1>
2050inline
2051typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2052unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2053 const_iterator hint,
2054 BSLS_COMPILERFEATURES_FORWARD_REF(Args_1) args_1)
2055{
2056 return iterator(d_impl.emplaceWithHint(hint.node(),
2057 BSLS_COMPILERFEATURES_FORWARD(Args_1, args_1)));
2058}
2059#endif // BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_B >= 1
2060
2061#if BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_B >= 2
2062template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2063template <class Args_1,
2064 class Args_2>
2065inline
2066typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2067unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2068 const_iterator hint,
2069 BSLS_COMPILERFEATURES_FORWARD_REF(Args_1) args_1,
2070 BSLS_COMPILERFEATURES_FORWARD_REF(Args_2) args_2)
2071{
2072 return iterator(d_impl.emplaceWithHint(hint.node(),
2073 BSLS_COMPILERFEATURES_FORWARD(Args_1, args_1),
2074 BSLS_COMPILERFEATURES_FORWARD(Args_2, args_2)));
2075}
2076#endif // BSLSTL_UNORDEREDMULTIMAP_VARIADIC_LIMIT_B >= 2
2077
2078#else
2079// The generated code below is a workaround for the absence of perfect
2080// forwarding in some compilers.
2081template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2082template <class... Args>
2083inline
2084typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2085unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::emplace(
2087{
2088 return iterator(d_impl.emplace(
2089 BSLS_COMPILERFEATURES_FORWARD(Args, args)...));
2090
2091}
2092
2093template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2094template <class... Args>
2095inline
2096typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2097unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2098 const_iterator hint,
2100{
2101 return iterator(d_impl.emplaceWithHint(hint.node(),
2102 BSLS_COMPILERFEATURES_FORWARD(Args, args)...));
2103}
2104// }}} END GENERATED CODE
2105#endif
2106
2107template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2108inline
2109typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2110unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::begin()
2112{
2113 return iterator(d_impl.elementListRoot());
2114}
2115
2116template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2117inline
2118typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2119unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::end()
2121{
2122 return iterator();
2123}
2124
2125template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2126inline
2127typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::local_iterator
2128unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::begin(size_type index)
2129{
2130 BSLS_ASSERT_SAFE(index < this->bucket_count());
2131
2132 return local_iterator(&d_impl.bucketAtIndex(index));
2133}
2134
2135template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2136inline
2137typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::local_iterator
2138unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::end(size_type index)
2139{
2140 BSLS_ASSERT_SAFE(index < this->bucket_count());
2141
2142 return local_iterator(0, &d_impl.bucketAtIndex(index));
2143}
2144
2145template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2146inline
2147void unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::clear()
2149{
2150 d_impl.removeAll();
2151}
2152
2153template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2154inline
2155bool unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::contains(
2156 const key_type& key) const
2157{
2158 return find(key) != end();
2159}
2160
2161template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2162inline
2163typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2164unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::find(
2165 const key_type& key)
2166{
2167 return iterator(d_impl.find(key));
2168}
2169
2170template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2171bsl::pair<
2172 typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator,
2173 typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator>
2174unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::equal_range(
2175 const key_type& key)
2176{
2177 HashTableLink *first;
2178 HashTableLink *last;
2179 d_impl.findRange(&first, &last, key);
2180 return bsl::pair<iterator, iterator>(iterator(first), iterator(last));
2181}
2182
2183template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2184inline
2185typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2186unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::erase(
2187 const_iterator position)
2188{
2189 BSLS_ASSERT(position != this->end());
2190
2191 return iterator(d_impl.remove(position.node()));
2192}
2193
2194template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2195inline
2196typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2197unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::erase(
2198 iterator position)
2199{
2200 return erase(const_iterator(position));
2201}
2202
2203template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2204typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::size_type
2205unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::erase(
2206 const key_type& key)
2207{ // As an alternative implementation, the table could return an extracted
2208 // "slice" list from the underlying table, and now need merely:
2209 // iterate each node, destroying the associated value
2210 // reclaim each node (potentially returning to a node-pool)
2211
2212 typedef ::BloombergLP::bslalg::BidirectionalNode<value_type> BNode;
2213
2214 if (HashTableLink *target = d_impl.find(key)) {
2215 target = d_impl.remove(target);
2216 size_type result = 1;
2217 while (target &&
2218 this->key_eq()(key, ListConfiguration::extractKey(
2219 static_cast<BNode *>(target)->value()))) {
2220 target = d_impl.remove(target);
2221 ++result;
2222 }
2223 return result; // RETURN
2224 }
2225
2226 return 0;
2227}
2228
2229template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2230typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2231unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::erase(
2232 const_iterator first,
2233 const_iterator last)
2234{
2235#if defined BDE_BUILD_TARGET_SAFE_2
2236 if (first != last) {
2237 iterator it = this->begin();
2238 const iterator end = this->end();
2239 for (; it != first; ++it) {
2240 BSLS_ASSERT(last != it);
2241 BSLS_ASSERT(end != it);
2242 }
2243 for (; it != last; ++it) {
2244 BSLS_ASSERT(end != it);
2245 }
2246 }
2247#endif
2248
2249 while (first != last) {
2250 first = this->erase(first);
2251 }
2252
2253 return iterator(first.node()); // convert from const_iterator
2254}
2255
2256template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2257inline
2258typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2259unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::insert(
2260 const value_type& value)
2261{
2262 return iterator(d_impl.insert(value));
2263}
2264
2265template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2266inline
2267typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::iterator
2268unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::insert(
2269 const_iterator hint,
2270 const value_type& value)
2271{
2272 return iterator(d_impl.insert(value, hint.node()));
2273}
2274
2275template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2276template <class INPUT_ITERATOR>
2277void unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::insert(
2278 INPUT_ITERATOR first,
2279 INPUT_ITERATOR last)
2280{
2281 insertFromRange(first, last);
2282}
2283
2284#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2285template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2286inline
2287void unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::insert(
2288 std::initializer_list<value_type> values)
2289{
2290 insert(values.begin(), values.end());
2291}
2292#endif
2293
2294template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2295inline
2296void unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::max_load_factor(
2297 float newLoadFactor)
2298{
2299 d_impl.setMaxLoadFactor(newLoadFactor);
2300}
2301
2302template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2303inline
2304void unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::rehash(
2305 size_type numBuckets)
2306{
2307 d_impl.rehashForNumBuckets(numBuckets);
2308}
2309
2310template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2311inline
2312void unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::reserve(
2313 size_type numElements)
2314{
2315 d_impl.reserveForNumElements(numElements);
2316}
2317
2318template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2319inline
2320void unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::swap(
2321 unordered_multimap& other)
2323 AllocatorTraits::is_always_equal::value &&
2324 bsl::is_nothrow_swappable<HASH>::value &&
2325 bsl::is_nothrow_swappable<EQUAL>::value)
2326{
2327 d_impl.swap(other.d_impl);
2328}
2329
2330// ACCESSORS
2331template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2332inline
2333ALLOCATOR
2334unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::get_allocator() const
2336{
2337 return d_impl.allocator();
2338}
2339
2340template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2341typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::const_iterator
2342unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::begin() const
2344{
2345 return const_iterator(d_impl.elementListRoot());
2346}
2347
2348template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2349inline
2350typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::const_iterator
2351unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::end() const
2353{
2354 return const_iterator();
2355}
2356
2357template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2358typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::const_iterator
2359unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::cbegin() const
2361{
2362 return const_iterator(d_impl.elementListRoot());
2363}
2364
2365template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2366inline
2367typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::const_iterator
2368unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::cend() const
2370{
2371 return const_iterator();
2372}
2373
2374template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2375inline
2376typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::
2377 const_local_iterator
2378unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::begin(
2379 size_type index) const
2380{
2381 BSLS_ASSERT_SAFE(index < this->bucket_count());
2382
2383 return const_local_iterator(&d_impl.bucketAtIndex(index));
2384}
2385
2386template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2387inline
2388typename
2389unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::const_local_iterator
2390unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::end(
2391 size_type index) const
2392{
2393 BSLS_ASSERT_SAFE(index < this->bucket_count());
2394
2395 return const_local_iterator(0, &d_impl.bucketAtIndex(index));
2396}
2397
2398template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2399inline
2400typename
2401unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::const_local_iterator
2402unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::cbegin(
2403 size_type index) const
2404{
2405 BSLS_ASSERT_SAFE(index < this->bucket_count());
2406
2407 return const_local_iterator(&d_impl.bucketAtIndex(index));
2408}
2409
2410template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2411inline
2412typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::
2413 const_local_iterator
2414unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::cend(
2415 size_type index) const
2416{
2417 BSLS_ASSERT_SAFE(index < this->bucket_count());
2418
2419 return const_local_iterator(0, &d_impl.bucketAtIndex(index));
2420}
2421
2422template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2423inline
2424typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::size_type
2425unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::bucket(
2426 const key_type& key) const
2427{
2428 return d_impl.bucketIndexForKey(key);
2429}
2430
2431template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2432inline
2433typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::size_type
2434unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::bucket_count() const
2436{
2437 return d_impl.numBuckets();
2438}
2439
2440template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2441inline
2442typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::size_type
2443unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::bucket_size(
2444 size_type index) const
2445{
2446 BSLS_ASSERT_SAFE(index < this->bucket_count());
2447
2448 return d_impl.countElementsInBucket(index);
2449}
2450
2451template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2452typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>:: size_type
2453unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::count(
2454 const key_type& key) const
2455{
2456 typedef ::BloombergLP::bslalg::BidirectionalNode<value_type> BNode;
2457
2458 size_type result = 0;
2459 for (HashTableLink *cursor = d_impl.find(key);
2460 cursor;
2461 ++result, cursor = cursor->nextLink())
2462 {
2463 BNode *cursorNode = static_cast<BNode *>(cursor);
2464 if (!this->key_eq()(key,
2465 ListConfiguration::extractKey(cursorNode->value()))) {
2466
2467 break;
2468 }
2469 }
2470 return result;
2471}
2472
2473template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2474inline
2475typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::const_iterator
2476unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::find(
2477 const key_type& key) const
2478{
2479 return const_iterator(d_impl.find(key));
2480}
2481
2482template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2483inline
2484bool unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::empty() const
2486{
2487 return 0 == d_impl.size();
2488}
2489
2490template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2491inline
2492typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::size_type
2493unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::size() const
2495{
2496 return d_impl.size();
2497}
2498
2499template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2500inline
2501typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::size_type
2502unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::max_size() const
2504{
2505 return AllocatorTraits::max_size(get_allocator());
2506}
2507
2508template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2509inline
2510typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::hasher
2511unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::hash_function() const
2512{
2513 return d_impl.hasher();
2514}
2515
2516template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2517inline
2518typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::key_equal
2519unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::key_eq() const
2520{
2521 return d_impl.comparator();
2522}
2523
2524template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2525bsl::pair<typename unordered_multimap<KEY,
2526 VALUE,
2527 HASH,
2528 EQUAL,
2529 ALLOCATOR>::const_iterator,
2530 typename unordered_multimap<KEY,
2531 VALUE,
2532 HASH,
2533 EQUAL,
2534 ALLOCATOR>::const_iterator>
2535unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::equal_range(
2536 const key_type& key) const
2537{
2538 HashTableLink *first;
2539 HashTableLink *last;
2540 d_impl.findRange(&first, &last, key);
2541 return bsl::pair<const_iterator, const_iterator>(const_iterator(first),
2542 const_iterator(last));
2543}
2544
2545template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2546inline
2547typename unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::size_type
2548unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>:: max_bucket_count()
2549 const
2551{
2552 return d_impl.maxNumBuckets();
2553}
2554
2555template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2556inline
2557float unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::load_factor()
2558 const
2560{
2561 return d_impl.loadFactor();
2562}
2563
2564template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2565inline
2566float unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>::max_load_factor()
2567 const
2569{
2570 return d_impl.maxLoadFactor();
2571}
2572
2573} // close namespace bsl
2574
2575// FREE OPERATORS
2576template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2577inline
2578bool bsl::operator==(
2581{
2582 return lhs.d_impl == rhs.d_impl;
2583}
2584
2585#ifndef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
2586template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2587inline
2588bool bsl::operator!=(
2591{
2592 return !(lhs == rhs);
2593}
2594#endif
2595
2596// FREE FUNCTIONS
2597template <class KEY,
2598 class VALUE,
2599 class HASH,
2600 class EQUAL,
2601 class ALLOCATOR,
2602 class PREDICATE>
2603inline
2605bsl::erase_if(unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>& m,
2606 PREDICATE predicate)
2607{
2608 return BloombergLP::bslstl::AlgorithmUtil::containerEraseIf(m, predicate);
2609}
2610
2611template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2612inline
2616{
2617 a.swap(b);
2618}
2619
2620// ============================================================================
2621// TYPE TRAITS
2622// ============================================================================
2623
2624// Type traits for STL *unordered* *associative* containers:
2625//: o An unordered associative container defines STL iterators.
2626//: o An unordered associative container is bitwise movable if both functors
2627//: and the allocator are bitwise movable.
2628//: o An unordered associative container uses 'bslma' allocators if the
2629//: (template parameter) type 'ALLOCATOR' is convertible from
2630//: 'bslma::Allocator*'.
2631
2632
2633
2634namespace bslalg {
2635
2636template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2637struct HasStlIterators<bsl::unordered_multimap<KEY,
2638 VALUE,
2639 HASH,
2640 EQUAL,
2641 ALLOCATOR> >
2643{};
2644
2645} // close namespace bslalg
2646
2647namespace bslma {
2648
2649template <class KEY, class VALUE, class HASH, class EQUAL, class ALLOCATOR>
2650struct UsesBslmaAllocator<bsl::unordered_multimap<KEY,
2651 VALUE,
2652 HASH,
2653 EQUAL,
2654 ALLOCATOR> >
2655: bsl::is_convertible<Allocator*, ALLOCATOR>::type
2656{};
2657
2658} // close namespace bslma
2659
2660namespace bslmf {
2661
2662template <class KEY, class MAPPED, class HASH, class EQUAL, class ALLOCATOR>
2663struct IsBitwiseMoveable<
2664 bsl::unordered_multimap<KEY, MAPPED, HASH, EQUAL, ALLOCATOR> >
2665 : ::BloombergLP::bslmf::IsBitwiseMoveable<BloombergLP::bslstl::HashTable<
2666 ::BloombergLP::bslstl::
2667 UnorderedMapKeyConfiguration<KEY, bsl::pair<const KEY, MAPPED> >,
2668 HASH,
2669 EQUAL,
2670 ALLOCATOR> >::type
2671{};
2672
2673}
2674
2675
2676#else // if ! defined(DEFINED_BSLSTL_UNORDEREDMULTIMAP_H)
2677# error Not valid except when included from bslstl_unorderedmultimap.h
2678#endif // ! defined(COMPILING_BSLSTL_UNORDEREDMULTIMAP_H)
2679
2680#endif // ! defined(INCLUDED_BSLSTL_UNORDEREDMULTIMAP_CPP03)
2681
2682// ----------------------------------------------------------------------------
2683// Copyright 2013 Bloomberg Finance L.P.
2684//
2685// Licensed under the Apache License, Version 2.0 (the "License");
2686// you may not use this file except in compliance with the License.
2687// You may obtain a copy of the License at
2688//
2689// http://www.apache.org/licenses/LICENSE-2.0
2690//
2691// Unless required by applicable law or agreed to in writing, software
2692// distributed under the License is distributed on an "AS IS" BASIS,
2693// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2694// See the License for the specific language governing permissions and
2695// limitations under the License.
2696// ----------------------------- END-OF-FILE ----------------------------------
2697
2698/** @} */
2699/** @} */
2700/** @} */
Definition bslma_bslallocator.h:588
Definition bslstl_pair.h:1280
Definition bslstl_unorderedmultimap.h:740
float max_load_factor() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultimap.h:3096
friend bool operator==(const unordered_multimap< KEY2, VALUE2, HASH2, EQUAL2, ALLOCATOR2 > &, const unordered_multimap< KEY2, VALUE2, HASH2, EQUAL2, ALLOCATOR2 > &)
enable_if< BloombergLP::bslmf::IsTransparentPredicate< HASH, LOOKUP_KEY >::value &&BloombergLP::bslmf::IsTransparentPredicate< EQUAL, LOOKUP_KEY >::value, pair< iterator, iterator > >::type equal_range(const LOOKUP_KEY &key)
Definition bslstl_unorderedmultimap.h:1248
unordered_multimap()
Definition bslstl_unorderedmultimap.h:2348
bool empty() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultimap.h:3014
const value_type & const_reference
Definition bslstl_unorderedmultimap.h:796
EQUAL key_eq() const
Definition bslstl_unorderedmultimap.h:3049
float load_factor() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultimap.h:3087
KEY key_type
Definition bslstl_unorderedmultimap.h:788
ALLOCATOR allocator_type
Definition bslstl_unorderedmultimap.h:793
AllocatorTraits::const_pointer const_pointer
Definition bslstl_unorderedmultimap.h:801
iterator end() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultimap.h:2649
size_type max_size() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultimap.h:3032
void reserve(size_type numElements)
Definition bslstl_unorderedmultimap.h:2842
HASH hash_function() const
Definition bslstl_unorderedmultimap.h:3041
::BloombergLP::bslstl::HashTableIterator< value_type, difference_type > iterator
Definition bslstl_unorderedmultimap.h:804
enable_if< BloombergLP::bslmf::IsTransparentPredicate< HASH, LOOKUP_KEY >::value &&BloombergLP::bslmf::IsTransparentPredicate< EQUAL, LOOKUP_KEY >::value, iterator >::type find(const LOOKUP_KEY &key)
Definition bslstl_unorderedmultimap.h:1339
unordered_multimap &operator=(BloombergLP::bslmf::MovableRef< unordered_multimap > rhs) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits iterator begin() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultimap.h:2640
size_type bucket(const key_type &key) const
Definition bslstl_unorderedmultimap.h:2955
value_type & reference
Definition bslstl_unorderedmultimap.h:795
HASH hasher
Definition bslstl_unorderedmultimap.h:791
const_iterator cbegin() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultimap.h:2889
void swap(unordered_multimap &other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits allocator_type get_allocator() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultimap.h:1573
const_iterator cend() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultimap.h:2898
unordered_multimap & operator=(const unordered_multimap &rhs)
Definition bslstl_unorderedmultimap.h:2566
enable_if< BloombergLP::bslmf::IsTransparentPredicate< HASH, LOOKUP_KEY >::value &&BloombergLP::bslmf::IsTransparentPredicate< EQUAL, LOOKUP_KEY >::value, size_type >::type count(const LOOKUP_KEY &key) const
Definition bslstl_unorderedmultimap.h:1667
::BloombergLP::bslstl::HashTableIterator< const value_type, difference_type > const_iterator
Definition bslstl_unorderedmultimap.h:807
EQUAL key_equal
Definition bslstl_unorderedmultimap.h:792
size_type max_bucket_count() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultimap.h:3078
size_type bucket_count() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultimap.h:2964
iterator insert(const value_type &value)
Definition bslstl_unorderedmultimap.h:2789
size_type size() const BSLS_KEYWORD_NOEXCEPT
Return the number of elements in this unordered multimap.
Definition bslstl_unorderedmultimap.h:3023
size_type erase(const key_type &key)
Definition bslstl_unorderedmultimap.h:2735
bool contains(const key_type &key) const
Definition bslstl_unorderedmultimap.h:2685
::BloombergLP::bslstl::HashTableBucketIterator< const value_type, difference_type > const_local_iterator
Definition bslstl_unorderedmultimap.h:813
AllocatorTraits::difference_type difference_type
Definition bslstl_unorderedmultimap.h:799
iterator emplace_hint(const_iterator hint, Args &&... args)
Definition bslstl_unorderedmultimap.h:2628
::BloombergLP::bslstl::HashTableBucketIterator< value_type, difference_type > local_iterator
Definition bslstl_unorderedmultimap.h:810
AllocatorTraits::pointer pointer
Definition bslstl_unorderedmultimap.h:800
bsl::pair< const KEY, VALUE > value_type
Definition bslstl_unorderedmultimap.h:790
AllocatorTraits::size_type size_type
Definition bslstl_unorderedmultimap.h:798
void rehash(size_type numBuckets)
Definition bslstl_unorderedmultimap.h:2834
iterator emplace(Args &&... args)
Definition bslstl_unorderedmultimap.h:2617
size_type bucket_size(size_type index) const
Definition bslstl_unorderedmultimap.h:2973
void clear() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultimap.h:2677
~unordered_multimap()
Destroy this object.
Definition bslstl_unorderedmultimap.h:2558
VALUE mapped_type
Definition bslstl_unorderedmultimap.h:789
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1976
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1917
#define BSLS_COMPILERFEATURES_FORWARD_REF(T)
Definition bsls_compilerfeatures.h:2343
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2349
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:674
#define BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(...)
Definition bsls_keyword.h:676
#define BSLSTL_UNORDEREDMULTIMAP_REQUIRES_CONTAINER_COMPATIBLE_RANGE(R, T)
Definition bslstl_unorderedmultimap.h:703
void swap(OptionValue &a, OptionValue &b)
bsl::size_t size(const TYPE &array)
Return the number of elements in the specified array.
int reserve(TYPE *array, int numElements)
Definition bdlat_valuetypefunctions.h:939
void swap(array< VALUE_TYPE, SIZE > &lhs, array< VALUE_TYPE, SIZE > &rhs)
ALLOCATOR const STRING_VIEW_LIKE_TYPE & rhs
Definition bslstl_string.h:3918
deque< VALUE_TYPE, ALLOCATOR >::size_type erase(deque< VALUE_TYPE, ALLOCATOR > &deq, const BDE_OTHER_TYPE &value)
Definition bslstl_deque.h:4424
T::iterator begin(T &container)
Definition bslstl_iterator.h:1593
const from_range_t from_range
bool operator==(const memory_resource &a, const memory_resource &b)
ALLOCATOR & lhs
Definition bslstl_string.h:3917
T::iterator end(T &container)
Definition bslstl_iterator.h:1621
deque< VALUE_TYPE, ALLOCATOR >::size_type erase_if(deque< VALUE_TYPE, ALLOCATOR > &deq, PREDICATE predicate)
Definition bslstl_deque.h:4433
bool operator!=(const memory_resource &a, const memory_resource &b)
BSLS_KEYWORD_CONSTEXPR bool empty(const CONTAINER &container)
Definition bslstl_iterator.h:1377
Definition bdlc_flathashmap.h:2218
Definition baljsn_encoder_testtypes.h:76
Definition bdlbb_blob.h:579
Definition bdldfp_decimal.h:5549
Definition bslma_allocatortraits.h:1089
BloombergLP::bslma::AllocatorTraits_ConstPointerType< ALLOCATOR >::type const_pointer
Definition bslma_allocatortraits.h:1183
BloombergLP::bslma::AllocatorTraits_SizeType< ALLOCATOR >::type size_type
Definition bslma_allocatortraits.h:1196
BloombergLP::bslma::AllocatorTraits_PointerType< ALLOCATOR >::type pointer
Definition bslma_allocatortraits.h:1180
BloombergLP::bslma::AllocatorTraits_DifferenceType< ALLOCATOR >::type difference_type
Definition bslma_allocatortraits.h:1193
Definition bslstl_equalto.h:316
Definition bslstl_ranges.h:301
Definition bslstl_hash.h:495
Definition bslmf_isconvertible.h:875