BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bslstl_unorderedmultiset_cpp03.h
Go to the documentation of this file.
1/// @file bslstl_unorderedmultiset_cpp03.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bslstl_unorderedmultiset_cpp03.h -*-C++-*-
8
9// Automatically generated file. **DO NOT EDIT**
10
11#ifndef INCLUDED_BSLSTL_UNORDEREDMULTISET_CPP03
12#define INCLUDED_BSLSTL_UNORDEREDMULTISET_CPP03
13
14/// @defgroup bslstl_unorderedmultiset_cpp03 bslstl_unorderedmultiset_cpp03
15/// @brief Provide C++03 implementation for bslstl_unorderedmultiset.h
16/// @addtogroup bsl
17/// @{
18/// @addtogroup bslstl
19/// @{
20/// @addtogroup bslstl_unorderedmultiset_cpp03
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bslstl_unorderedmultiset_cpp03-purpose"> Purpose</a>
25/// * <a href="#bslstl_unorderedmultiset_cpp03-classes"> Classes </a>
26/// * <a href="#bslstl_unorderedmultiset_cpp03-description"> Description </a>
27///
28/// # Purpose {#bslstl_unorderedmultiset_cpp03-purpose}
29/// Provide C++03 implementation for bslstl_unorderedmultiset.h
30///
31/// # Classes {#bslstl_unorderedmultiset_cpp03-classes}
32/// See bslstl_unorderedmultiset.h for list of classes
33///
34/// @see bslstl_unorderedmultiset
35///
36/// # Description {#bslstl_unorderedmultiset_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 19 20:53:55 2026
48/// Command line: sim_cpp11_features.pl bslstl_unorderedmultiset.h
49/// @}
50/** @} */
51/** @} */
52
53/** @addtogroup bsl
54 * @{
55 */
56/** @addtogroup bslstl
57 * @{
58 */
59/** @addtogroup bslstl_unorderedmultiset_cpp03
60 * @{
61 */
62
63#ifdef COMPILING_BSLSTL_UNORDEREDMULTISET_H
64
65namespace bsl {
66
67 // ========================
68 // class unordered_multiset
69 // ========================
70
71/// This class template implements a value-semantic container type holding
72/// an unordered multiset of values (of template parameter type `KEY`).
73///
74/// This class:
75/// * supports a complete set of *value-semantic* operations
76/// - except for BDEX serialization
77/// * is *exception-neutral* (agnostic except for the `at` method)
78/// * is *alias-safe*
79/// * is `const` *thread-safe*
80/// For terminology see @ref bsldoc_glossary .
81template <class KEY,
82 class HASH = bsl::hash<KEY>,
83 class EQUAL = bsl::equal_to<KEY>,
84 class ALLOCATOR = bsl::allocator<KEY> >
85class unordered_multiset
86{
87
88 private:
89
90 // PRIVATE TYPE
91
92 /// This typedef is an alias for the allocator traits type associated
93 /// with this container.
94 typedef bsl::allocator_traits<ALLOCATOR> AllocatorTraits;
95
96 /// This typedef is an alias for the type of values maintained by this
97 /// unordered multiset.
98 typedef KEY ValueType;
99
100 /// This typedef is an alias for the policy used internally by this
101 /// container to extract the `KEY` value from the values maintained by
102 /// this unordered multiset.
103 typedef ::BloombergLP::bslstl::UnorderedSetKeyConfiguration<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 /// multiset.
109 typedef ::BloombergLP::bslstl::HashTable<ListConfiguration,
110 HASH,
111 EQUAL,
112 ALLOCATOR> HashTable;
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 HASH2,
125 class EQUAL2,
126 class ALLOCATOR2>
127 friend bool operator==(
128 const unordered_multiset<KEY2, HASH2, EQUAL2, ALLOCATOR2>&,
129 const unordered_multiset<KEY2, HASH2, EQUAL2, ALLOCATOR2>&);
130
131 public:
132 // PUBLIC TYPES
133 typedef KEY key_type;
134 typedef KEY value_type;
135 typedef HASH hasher;
136 typedef EQUAL key_equal;
137 typedef ALLOCATOR allocator_type;
138 typedef value_type& reference;
139 typedef const value_type& const_reference;
140
141 typedef typename AllocatorTraits::size_type size_type;
143 typedef typename AllocatorTraits::pointer pointer;
145
146 typedef ::BloombergLP::bslstl::HashTableIterator<
148
149 typedef ::BloombergLP::bslstl::HashTableBucketIterator<
151
152 typedef iterator const_iterator;
154
155 public:
156 // TRAITS
159 ::BloombergLP::bslmf::IsBitwiseMoveable,
160 ::BloombergLP::bslmf::IsBitwiseMoveable<HashTable>::value);
161
162 private:
163 // DATA
164 HashTable d_impl;
165
166 public:
167 // CREATORS
168
169 /// Create an empty unordered multiset. Optionally specify an
170 /// `initialNumBuckets` indicating the initial size of the array of
171 /// buckets of this container. If `initialNumBuckets` is not supplied,
172 /// a single bucket is used. Optionally specify a `hashFunction` used
173 /// to generate the hash values for the keys contained in this unordered
174 /// multiset. If `hashFunction` is not supplied, a default-constructed
175 /// object of the (template parameter) type `HASH` is used. Optionally
176 /// specify a key-equality functor `keyEqual` used to verify that two
177 /// keys are equivalent. If `keyEqual` is not supplied, a
178 /// default-constructed object of the (template parameter) type `EQUAL`
179 /// is used. Optionally specify a `basicAllocator` used to supply
180 /// memory. If `basicAllocator` is not supplied, a default-constructed
181 /// object of the (template parameter) type `ALLOCATOR` is used. If the
182 /// type `ALLOCATOR` is `bsl::allocator` (the default), then
183 /// `basicAllocator`, if supplied, shall be convertible to
184 /// `bslma::Allocator *`. If the type `ALLOCATOR` is `bsl::allocator`
185 /// and `basicAllocator` is not supplied, the currently installed
186 /// default allocator is used.
188 explicit unordered_multiset(size_type initialNumBuckets,
189 const HASH& hashFunction = HASH(),
190 const EQUAL& keyEqual = EQUAL(),
191 const ALLOCATOR& basicAllocator = ALLOCATOR());
192 unordered_multiset(size_type initialNumBuckets,
193 const HASH& hashFunction,
194 const ALLOCATOR& basicAllocator);
195 unordered_multiset(size_type initialNumBuckets,
196 const ALLOCATOR& basicAllocator);
197 explicit unordered_multiset(const ALLOCATOR& basicAllocator);
198
199 /// Create an unordered multiset having the same value as the specified
200 /// `original` object. Use a copy of `original.hash_function()` to
201 /// generate hash values for the keys contained in this unordered
202 /// multiset. Use a copy of `original.key_eq()` to verify that two keys
203 /// are equivalent. Use the allocator returned by
204 /// `bsl::allocator_traits<ALLOCATOR>::
205 /// select_on_container_copy_construction(original.get_allocator())` to
206 /// allocate memory. This method requires that the (template parameter)
207 /// type `KEY` be `copy-insertable` into this unordered multiset (see
208 /// {Requirements on `KEY`}).
209 unordered_multiset(const unordered_multiset& original);
210
211 /// Create an unordered multiset having the same value as the specified
212 /// `original` object by moving (in constant time) the contents of
213 /// `original` to the new unordered multiset. Use a copy of
214 /// `original.hash_function()` to generate hash values for the keys
215 /// contained in this unordered multiset. Use a copy of
216 /// `original.key_eq()` to verify that two keys are equivalent. The
217 /// allocator associated with `original` is propagated for use in the
218 /// newly-created unordered multiset. `original` is left in a valid but
219 /// unspecified state.
221 BloombergLP::bslmf::MovableRef<unordered_multiset> original);
222
223 /// Create an unordered multiset having the same value as the specified
224 /// `original` object that uses the specified `basicAllocator` to supply
225 /// memory. Use a copy of `original.hash_function()` to generate hash
226 /// values for the keys contained in this unordered multiset. Use a
227 /// copy of `original.key_eq()` to verify that two keys are equivalent.
228 /// This method requires that the (template parameter) type `KEY` be
229 /// `copy-insertable` into this unordered multiset (see {Requirements on `KEY`}).
230 ///
231 /// \note Note that a `bslma::Allocator *` can be supplied for
232 /// `basicAllocator` if the (template parameter) type `ALLOCATOR` is
233 /// `bsl::allocator` (the default).
235 const unordered_multiset& original,
236 const typename type_identity<ALLOCATOR>::type& basicAllocator);
237
238 /// Create an unordered multiset 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 multiset 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 /// multiset. Use a copy of `original.key_eq()` to verify that two keys
247 /// are equivalent. This method requires that the (template parameter)
248 /// type `KEY` be `move-insertable` into this unordered multiset (see {Requirements on `KEY`}).
249 ///
250 /// \note Note that a `bslma::Allocator *` can be
251 /// supplied for `basicAllocator` if the (template parameter) type
252 /// `ALLOCATOR` is `bsl::allocator` (the default).
254 BloombergLP::bslmf::MovableRef<unordered_multiset> original,
255 const typename type_identity<ALLOCATOR>::type& basicAllocator);
256
257 /// Create an unordered multiset, and insert each `value_type` object in
258 /// the sequence starting at the specified `first` element, and ending
259 /// immediately before the specified `last` element. Optionally specify
260 /// an `initialNumBuckets` indicating the initial size of the array of
261 /// buckets of this container. If `initialNumBuckets` is not supplied,
262 /// a single bucket is used. Optionally specify a `hashFunction` used
263 /// to generate hash values for the keys contained in this unordered
264 /// multiset. If `hashFunction` is not supplied, a default-constructed
265 /// object of (template parameter) type `HASH` is used. Optionally
266 /// specify a key-equality functor `keyEqual` used to verify that two
267 /// keys are equivalent. If `keyEqual` is not supplied, a
268 /// default-constructed object of (template parameter) type `EQUAL` is
269 /// used. Optionally specify a `basicAllocator` used to supply memory.
270 /// If `basicAllocator` is not supplied, a default-constructed object of
271 /// the (template parameter) type `ALLOCATOR` is used. If the type
272 /// `ALLOCATOR` is `bsl::allocator` and `basicAllocator` is not
273 /// supplied, the currently installed default allocator is used to
274 /// supply memory. The (template parameter) type `INPUT_ITERATOR` shall
275 /// meet the requirements of an input iterator defined in the C++11
276 /// standard [24.2.3] providing access to values of a type convertible
277 /// to `value_type`, and `value_type` must be `emplace-constructible`
278 /// from `*i` into this unordered multiset, where `i` is a
279 /// dereferenceable iterator in the range `[first .. last)` (see {Requirements on `KEY`}).
280 ///
281 /// \pre The behavior is undefined unless `first`
282 /// and `last` refer to a sequence of valid values where `first` is at a position at or before `last`.
283 ///
284 /// \note Note that a `bslma::Allocator *` can
285 /// be supplied for `basicAllocator` if the type `ALLOCATOR` is
286 /// `bsl::allocator` (the default).
287 template <class INPUT_ITERATOR>
288 unordered_multiset(INPUT_ITERATOR first,
289 INPUT_ITERATOR last,
290 size_type initialNumBuckets = 0,
291 const HASH& hashFunction = HASH(),
292 const EQUAL& keyEqual = EQUAL(),
293 const ALLOCATOR& basicAllocator = ALLOCATOR());
294 template <class INPUT_ITERATOR>
295 unordered_multiset(INPUT_ITERATOR first,
296 INPUT_ITERATOR last,
297 size_type initialNumBuckets,
298 const HASH& hashFunction,
299 const ALLOCATOR& basicAllocator);
300 template <class INPUT_ITERATOR>
301 unordered_multiset(INPUT_ITERATOR first,
302 INPUT_ITERATOR last,
303 size_type initialNumBuckets,
304 const ALLOCATOR& basicAllocator);
305 template <class INPUT_ITERATOR>
306 unordered_multiset(INPUT_ITERATOR first,
307 INPUT_ITERATOR last,
308 const ALLOCATOR& basicAllocator);
309
310#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
311# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
312 template <
313 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
314 class = bsl::enable_if_t<
315 std::is_invocable_v<EQUAL, const KEY &, const KEY &>>,
316 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
317 >
318# endif
320 std::initializer_list<KEY> values,
321 size_type initialNumBuckets = 0,
322 const HASH& hashFunction = HASH(),
323 const EQUAL& keyEqual = EQUAL(),
324 const ALLOCATOR& basicAllocator = ALLOCATOR());
325# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
326 template <
327 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
328 class = bsl::enable_if_t<bsl::IsStdAllocator<ALLOCATOR>::value>
329 >
330# endif
331 unordered_multiset(std::initializer_list<KEY> values,
332 size_type initialNumBuckets,
333 const HASH& hashFunction,
334 const ALLOCATOR& basicAllocator);
335# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
336 template <class = bsl::enable_if_t<bsl::IsStdAllocator<ALLOCATOR>::value>>
337# endif
338 unordered_multiset(std::initializer_list<KEY> values,
339 size_type initialNumBuckets,
340 const ALLOCATOR& basicAllocator);
341# ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
342 /// Create an unordered multiset and insert each `value_type` object in
343 /// the specified `values` initializer list. Optionally specify an
344 /// `initialNumBuckets` indicating the initial size of the array of
345 /// buckets of this container. If `initialNumBuckets` is not supplied,
346 /// a single bucket is used. Optionally specify a `hashFunction` used
347 /// to generate the hash values for the keys contained in this unordered
348 /// multiset. If `hashFunction` is not supplied, a default-constructed
349 /// object of the (template parameter) type `HASH` is used. Optionally
350 /// specify a key-equality functor `keyEqual` used to verify that two
351 /// keys are equivalent. If `keyEqual` is not supplied, a
352 /// default-constructed object of the (template parameter) type `EQUAL`
353 /// is used. Optionally specify a `basicAllocator` used to supply
354 /// memory. If `basicAllocator` is not supplied, a default-constructed
355 /// object of the (template parameter) type `ALLOCATOR` is used. If the
356 /// type `ALLOCATOR` is `bsl::allocator` and `basicAllocator` is not
357 /// supplied, the currently installed default allocator is used to
358 /// supply memory. This method requires that the (template parameter)
359 /// type `KEY` be `copy-insertable` into this unordered multiset (see {Requirements on `KEY`}).
360 ///
361 /// \note Note that a `bslma::Allocator *` can be
362 /// supplied for `basicAllocator` if the type `ALLOCATOR` is
363 /// `bsl::allocator` (the default).
364 template <class = bsl::enable_if_t<bsl::IsStdAllocator<ALLOCATOR>::value>>
365# endif
366 unordered_multiset(std::initializer_list<KEY> values,
367 const ALLOCATOR& basicAllocator);
368#endif
369
370 /// Create an unordered multiset, and insert each `value_type` object in
371 /// the specified `range`. Optionally specify an `initialNumBuckets`
372 /// indicating the initial size of the array of buckets of this
373 /// container. If `initialNumBuckets` is not supplied, an
374 /// implementation-defined value is used. Optionally specify a
375 /// `hashFunction` used to generate the hash values for each key value
376 /// contained in this unordered multiset. If `hashFunction` is not
377 /// supplied, a default-constructed object of the (template parameter)
378 /// type `HASH` is used. Optionally specify a key-equality functor
379 /// `keyEqual` used to determine whether two keys have the same value.
380 /// If `keyEqual` is not supplied, a default-constructed object of the
381 /// (template parameter) type `EQUAL` is used. Optionally specify a
382 /// `basicAllocator` used to supply memory. If `basicAllocator` is not
383 /// supplied, a default-constructed object of the (template parameter)
384 /// type `ALLOCATOR` is used. If the type `ALLOCATOR` is
385 /// `bsl::allocator` (the default), then `basicAllocator`, if supplied,
386 /// shall be convertible to `bslma::Allocator *`. If the type
387 /// `ALLOCATOR` is `bsl::allocator` and `basicAllocator` is not
388 /// supplied, the currently installed default allocator is used. This
389 /// operation has `O[N]` complexity, where `N` is the number of elements in `range`.
390 ///
391 /// \note Note that `RANGE` must meet the requirements of an
392 /// input range and the values from `range` must have a type matching or
393 /// convertible to `value_type`.
394 template <class RANGE>
396 value_type)
398 bsl::from_range_t ,
399 BSLS_COMPILERFEATURES_FORWARD_REF(RANGE) range,
400 size_type initialNumBuckets = 0,
401 const HASH& hashFunction = HASH(),
402 const EQUAL& keyEqual = EQUAL(),
403 const ALLOCATOR& basicAllocator = ALLOCATOR())
404 : d_impl(hashFunction, keyEqual, initialNumBuckets, 1.0f, basicAllocator)
405 {
406 // Defined inline for Windows.
407
408#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
409&& defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
410 if constexpr (ranges::sized_range<RANGE>) {
411 insertFromRange(bsl::ranges::begin(range),
412 bsl::ranges::end (range),
413 bsl::ranges::size (range));
414 } else // ...
415#endif
416 {
417 insertFromRange(bsl::ranges::begin(range),
418 bsl::ranges::end (range));
419 }
420 }
421
422 template <class RANGE>
428 size_type initialNumBuckets,
429 const HASH& hashFunction,
430 const ALLOCATOR& basicAllocator)
431 : d_impl(hashFunction, EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
432 {
433 // Defined inline for Windows.
434
436 range,
437 initialNumBuckets,
438 hashFunction,
439 EQUAL(),
440 basicAllocator);
441 this->swap(other);
442 }
443
444 template <class RANGE>
450 size_type initialNumBuckets,
451 const ALLOCATOR& basicAllocator)
452 : d_impl(HASH(), EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
453 {
454 // Defined inline for Windows.
455
457 range,
458 initialNumBuckets,
459 HASH(),
460 EQUAL(),
461 basicAllocator);
462 this->swap(other);
463 }
464
465 template <class RANGE>
470 const ALLOCATOR& basicAllocator)
471 : d_impl(HASH(), EQUAL(), 0, 1.0f, basicAllocator)
472 {
473 // Defined inline for Windows.
474
476 range,
477 0,
478 HASH(),
479 EQUAL(),
480 basicAllocator);
481 this->swap(other);
482 }
483
484 /// Destroy this object.
486
487 // MANIPULATORS
488
489 /// Assign to this object the value, hash function, and equality
490 /// comparator of the specified `rhs` object, propagate to this object
491 /// the allocator of `rhs` if the `ALLOCATOR` type has trait
492 /// @ref propagate_on_container_copy_assignment , and return a reference
493 /// providing modifiable access to this object. If an exception is
494 /// thrown, `*this` is left in a valid but unspecified state. This
495 /// method requires that the (template parameter) type `KEY` be both
496 /// `copy-assignable` and `copy-insertable` into this unordered multiset
497 /// (see {Requirements on `KEY`}).
499
500 /// Assign to this object the value, hash function, and equality
501 /// comparator of the specified `rhs` object, propagate to this object
502 /// the allocator of `rhs` if the `ALLOCATOR` type has trait
503 /// @ref propagate_on_container_move_assignment , and return a reference
504 /// providing modifiable access to this object. The contents of `rhs`
505 /// are moved (in constant time) to this unordered multiset if
506 /// `get_allocator() == rhs.get_allocator()` (after accounting for the
507 /// aforementioned trait); otherwise, all elements in this unordered
508 /// multiset are either destroyed or move-assigned to and each
509 /// additional element in `rhs` is move-inserted into this unordered
510 /// multiset. `rhs` is left in a valid but unspecified state, and if an
511 /// exception is thrown, `*this` is left in a valid but unspecified
512 /// state. This method requires that the (template parameter) type
513 /// `KEY` be both `move-assignable` and `move-insertable` into this
514 /// unordered multiset (see {Requirements on `KEY`}).
516 operator=(BloombergLP::bslmf::MovableRef<unordered_multiset> rhs)
518 AllocatorTraits::is_always_equal::value
519 && std::is_nothrow_move_assignable<HASH>::value
520 && std::is_nothrow_move_assignable<EQUAL>::value);
521
522#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
523 /// Assign to this object the value resulting from first clearing this
524 /// unordered multiset and then inserting each `value_type` object in
525 /// the specified `values` initializer list, and return a reference
526 /// providing modifiable access to this object. This method requires
527 /// that the (template parameter) type `KEY` be `copy-insertable` into
528 /// this unordered multiset (see {Requirements on `KEY`}).
529 unordered_multiset& operator=(std::initializer_list<KEY> values);
530#endif
531
532 /// Return an iterator providing modifiable access to the first
533 /// `value_type` object (in the sequence of `value_type` objects)
534 /// maintained by this unordered multiset, or the `end` iterator if this
535 /// unordered multiset is empty.
537
538 /// Return an iterator providing modifiable access to the past-the-end
539 /// element in the sequence of `value_type` objects maintained by this
540 /// unordered multiset.
542
543 /// Return a local iterator providing modifiable access to the first
544 /// `value_type` object in the sequence of `value_type` objects of the
545 /// bucket having the specified `index`, in the array of buckets
546 /// maintained by this unordered multiset, or the `end(index)`
547 /// otherwise.
549
550 /// Return a local iterator providing modifiable access to the
551 /// past-the-end element in the sequence of `value_type` objects of the
552 /// bucket having the specified `index`, in the array of buckets
553 /// maintained by this unordered multiset.
555
556 /// Remove all entries from this unordered multiset.
557 /// \note Note that the
558 /// container is empty after this call, but allocated memory may be
559 /// retained for future use.
561
562 /// Return a pair of iterators providing modifiable access to the
563 /// sequence of `value_type` objects in this unordered multiset
564 /// equivalent to the specified `key`, where the first iterator is
565 /// positioned at the start of the sequence, and the second is
566 /// positioned one past the end of the sequence. If this unordered
567 /// multiset contains no `value_type` objects equivalent to the `key`,
568 /// then the two returned iterators will have the same value.
569 ///
570 /// \pre The behavior is undefined unless `key` is equivalent to the elements of
571 /// at most one equivalent-key group in this unordered multiset.
572 template <class LOOKUP_KEY>
573 typename enable_if<
574 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
575 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
576 pair<iterator, iterator> >::type
577 equal_range(const LOOKUP_KEY& key)
578 {
579 // Note: implemented inline due to Sun CC compilation error.
580 typedef bsl::pair<iterator, iterator> ResultType;
581 HashTableLink *first;
582 HashTableLink *last;
583 d_impl.findRange(&first, &last, key);
584 return ResultType(iterator(first), iterator(last));
585 }
586
587 /// Return a pair of iterators providing modifiable access to the
588 /// sequence of `value_type` objects in this unordered multiset
589 /// equivalent to the specified `key`, where the first iterator is
590 /// positioned at the start of the sequence, and the second is
591 /// positioned one past the end of the sequence. If this unordered
592 /// multiset contains no `value_type` objects equivalent to the `key`,
593 /// then the two returned iterators will have the same value.
594 pair<iterator, iterator> equal_range(const key_type& key);
595
596 /// Remove from this unordered multiset all `value_type` objects that
597 /// are equivalent to the specified `key`, if they exist, and return the
598 /// number of object erased; otherwise, if there are no `value_type`
599 /// objects equivalent to `key`, return 0 with no other effect. This
600 /// method invalidates only iterators and references to the removed
601 /// element and previously saved values of the `end()` iterator, and
602 /// preserves the relative order of the elements not removed.
603 size_type erase(const key_type& key);
604 template <class t_KEY>
605 typename enable_if<
606 BloombergLP::bslmf::IsTransparentPredicate<HASH, t_KEY>::value &&
607 BloombergLP::bslmf::IsTransparentPredicate<EQUAL,t_KEY>::value &&
608 !is_convertible<BSLS_COMPILERFEATURES_FORWARD_REF(t_KEY),
609 iterator>::value &&
610 !is_convertible<BSLS_COMPILERFEATURES_FORWARD_REF(t_KEY),
611 const_iterator>::value,
613 {
614 // Implemented inline due to Sun CC compilation error.
615 size_type count = 0;
616 // Our implementation always finds the first element
617 iterator it = this->find(key);
618 if (it != end()) {
619 do {
620 it = erase(it);
621 count++;
622 } while (it != end() && key_eq()(*it, key));
623 }
624 return count;
625 }
626
627 /// Remove from this unordered multiset the `value_type` object at the
628 /// specified `position`, and return an iterator referring to the
629 /// element immediately following the removed element, or to the
630 /// past-the-end position if the removed element was the last element in
631 /// the sequence of elements maintained by this unordered multiset.
632 /// This method invalidates only iterators and references to the removed
633 /// element and previously saved values of the `end()` iterator, and
634 /// preserves the relative order of the elements not removed.
635 ///
636 /// \pre The behavior is undefined unless `position` refers to a `value_type`
637 /// object in this unordered multiset.
638 iterator erase(const_iterator position);
639
640 /// Remove from unordered multiset the `value_type` objects starting at
641 /// the specified `first` position up to, but not including the
642 /// specified `last` position, and return `last`. This method
643 /// invalidates only iterators and references to the removed element and
644 /// previously saved values of the `end()` iterator, and preserves the
645 /// relative order of the elements not removed.
646 ///
647 /// \pre The behavior is undefined unless `first` and `last` either refer to elements in this
648 /// unordered multiset or are the `end` iterator, and the `first`
649 /// position is at or before the `last` position in the sequence
650 /// provided by this container.
652
653 /// Return an iterator providing modifiable access to the first
654 /// `value_type` object in the sequence of all the value elements of
655 /// this unordered multiset equivalent to the specified `key`, if such
656 /// entries exist, and the past-the-end (`end`) iterator otherwise.
657 ///
658 /// \pre The behavior is undefined unless `key` is equivalent to the elements of
659 /// at most one equivalent-key group in this unordered multiset.
660 template <class LOOKUP_KEY>
661 typename enable_if<
662 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
663 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
664 iterator>::type
665 find(const LOOKUP_KEY& key)
666 {
667 // Note: implemented inline due to Sun CC compilation error.
668 return iterator(d_impl.find(key));
669 }
670
671 /// Return an iterator providing modifiable access to the first
672 /// `value_type` object in the sequence of all the value elements of
673 /// this unordered multiset equivalent to the specified `key`, if such
674 /// entries exist, and the past-the-end (`end`) iterator otherwise.
675 iterator find(const key_type& key);
676
677 /// Insert the specified `value` into this unordered multiset. If one
678 /// or more keys equivalent to `value` already exist in this unordered
679 /// multiset, this method is guaranteed to insert `value` in a position
680 /// contiguous to one of those equivalent keys. Return an iterator
681 /// referring to the newly inserted `value_type` object that is equivalent to `value`.
682 ///
683 /// \note Note that this method requires that the
684 /// (template parameter) type `KEY` be `copy-insertable` into this
685 /// unordered multiset (see {Requirements on `KEY`}).
686 iterator insert(const value_type& value);
687
688 /// Insert the specified `value` into this unordered multiset. If one
689 /// or more keys equivalent to `value` already exist in this unordered
690 /// multiset, this method is guaranteed to insert `value` in a position
691 /// contiguous to one of those equivalent keys. Return an iterator
692 /// referring to the newly inserted `value_type` object that is
693 /// equivalent to `value`. This method requires that the (template
694 /// parameter) type `KEY` be `move-insertable` into this unordered
695 /// multiset (see {Requirements on `KEY`}).
696 iterator insert(BloombergLP::bslmf::MovableRef<value_type> value);
697
698 /// Insert the specified `value` into this unordered multiset (in
699 /// constant time if the specified `hint` refers to an element in this
700 /// container equivalent to `value`). If one or more keys equivalent to
701 /// `value` already exist in this unordered multiset, this method is
702 /// guaranteed to insert `value` in a position contiguous to one of
703 /// those equivalent keys. Return an iterator referring to the newly
704 /// inserted `value_type` object that is equivalent to `value`. If
705 /// `hint` does not refer to an element in this container equivalent to
706 /// `value`, this operation has worst case `O[N]` and average case
707 /// constant-time complexity, where `N` is the size of this unordered
708 /// multiset. This method requires that the (template parameter) type
709 /// `KEY` be `copy-insertable` into this unordered multiset (see {Requirements on `KEY`}).
710 ///
711 /// \pre The behavior is undefined unless `hint`
712 /// is an iterator in the range `[begin() .. end()]` (both endpoints
713 /// included).
714 iterator insert(const_iterator hint, const value_type& value);
715
716 /// Insert the specified `value` into this unordered multiset (in
717 /// constant time if the specified `hint` refers to an element in this
718 /// container equivalent to `value`). If one or more keys equivalent to
719 /// `value` already exist in this unordered multiset, this method is
720 /// guaranteed to insert `value` in a position contiguous to one of
721 /// those equivalent keys. Return an iterator referring to the newly
722 /// inserted `value_type` object that is equivalent to `value`. If
723 /// `hint` does not refer to an element in this container equivalent to
724 /// `value`, this operation has worst case `O[N]` and average case
725 /// constant-time complexity, where `N` is the size of this unordered
726 /// multiset. This method requires that the (template parameter) type
727 /// `KEY` be `move-insertable` into this unordered multiset (see {Requirements on `KEY`}).
728 ///
729 /// \pre The behavior is undefined unless `hint`
730 /// is an iterator in the range `[begin() .. end()]` (both endpoints
731 /// included).
733 BloombergLP::bslmf::MovableRef<value_type> value);
734
735 /// Insert into this unordered multiset the value of each `value_type`
736 /// object in the range starting at the specified `first` iterator and
737 /// ending immediately before the specified `last` iterator. The
738 /// (template parameter) type `INPUT_ITERATOR` shall meet the
739 /// requirements of an input iterator defined in the C++11 standard
740 /// [24.2.3] providing access to values of a type convertible to
741 /// `value_type`, and `value_type` must be `emplace-constructible` from
742 /// `*i` into this unordered multiset, where `i` is a dereferenceable
743 /// iterator in the range `[first .. last)` (see {Requirements on `KEY`}).
744 ///
745 /// \pre The behavior is undefined unless `first` and `last` refer
746 /// to a sequence of valid values where `first` is at a position at or
747 /// before `last`.
748 template <class INPUT_ITERATOR>
749 void insert(INPUT_ITERATOR first, INPUT_ITERATOR last);
750
751#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
752 /// Insert into this unordered multiset the value of each `value_type`
753 /// object in the specified `values` initializer list. This method
754 /// requires that the (template parameter) type `KEY` be
755 /// `copy-insertable` into this unordered multiset (see {Requirements on
756 /// `KEY`}).
757 void insert(std::initializer_list<KEY> values);
758#endif
759
760 /// Insert into this unordered multiset the value of each `value_type`
761 /// object in the specified `range`. The (template parameter) type
762 /// `RANGE` must meet the requirements the C++20 standard [ranges]
763 /// providing access to values of a type convertible to `value_type`,
764 /// and `value_type` must be `emplace-constructible` from `*i` into this
765 /// unordered multiset, where `i` is a dereferenceable iterator obtained
766 /// from `range` (see {Requirements on `KEY`}).
767 ///
768 /// \pre The behavior is undefined if `range` overlaps this unordered multiset.
769 template <class RANGE>
772 void insert_range(BSLS_COMPILERFEATURES_FORWARD_REF(RANGE) range)
773 {
774 // Defined inline for Windows.
775
776#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
777&& defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
778 if constexpr (ranges::sized_range<RANGE>) {
779 insertFromRange(bsl::ranges::begin(range),
780 bsl::ranges::end (range),
781 bsl::ranges::size (range));
782 } else // ...
783#endif
784 {
785 insertFromRange(bsl::ranges::begin(range),
786 bsl::ranges::end (range));
787 }
788 }
789
790#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
791// {{{ BEGIN GENERATED CODE
792// Command line: sim_cpp11_features.pl bslstl_unorderedmultiset.h
793#ifndef BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT
794#define BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT 10
795#endif
796#ifndef BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A
797#define BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT
798#endif
799#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 0
801#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 0
802
803#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 1
804 template <class Args_01>
806#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 1
807
808#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 2
809 template <class Args_01,
810 class Args_02>
812 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02);
813#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 2
814
815#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 3
816 template <class Args_01,
817 class Args_02,
818 class Args_03>
820 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
821 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03);
822#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 3
823
824#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 4
825 template <class Args_01,
826 class Args_02,
827 class Args_03,
828 class Args_04>
830 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
831 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
832 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04);
833#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 4
834
835#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 5
836 template <class Args_01,
837 class Args_02,
838 class Args_03,
839 class Args_04,
840 class Args_05>
842 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
843 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
844 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
845 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05);
846#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 5
847
848#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 6
849 template <class Args_01,
850 class Args_02,
851 class Args_03,
852 class Args_04,
853 class Args_05,
854 class Args_06>
856 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
857 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
858 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
859 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
860 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06);
861#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 6
862
863#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 7
864 template <class Args_01,
865 class Args_02,
866 class Args_03,
867 class Args_04,
868 class Args_05,
869 class Args_06,
870 class Args_07>
872 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
873 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
874 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
875 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
876 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
877 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07);
878#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 7
879
880#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 8
881 template <class Args_01,
882 class Args_02,
883 class Args_03,
884 class Args_04,
885 class Args_05,
886 class Args_06,
887 class Args_07,
888 class Args_08>
890 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
891 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
892 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
893 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
894 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
895 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
896 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08);
897#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 8
898
899#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 9
900 template <class Args_01,
901 class Args_02,
902 class Args_03,
903 class Args_04,
904 class Args_05,
905 class Args_06,
906 class Args_07,
907 class Args_08,
908 class Args_09>
910 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
911 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
912 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
913 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
914 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
915 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
916 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
917 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09);
918#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 9
919
920#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 10
921 template <class Args_01,
922 class Args_02,
923 class Args_03,
924 class Args_04,
925 class Args_05,
926 class Args_06,
927 class Args_07,
928 class Args_08,
929 class Args_09,
930 class Args_10>
932 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
933 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
934 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
935 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
936 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
937 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
938 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
939 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09,
940 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) args_10);
941#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 10
942
943
944#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 0
946#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 0
947
948#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 1
949 template <class Args_01>
951 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01);
952#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 1
953
954#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 2
955 template <class Args_01,
956 class Args_02>
958 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
959 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02);
960#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 2
961
962#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 3
963 template <class Args_01,
964 class Args_02,
965 class Args_03>
967 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
968 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
969 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03);
970#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 3
971
972#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 4
973 template <class Args_01,
974 class Args_02,
975 class Args_03,
976 class Args_04>
978 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
979 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
980 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
981 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04);
982#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 4
983
984#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 5
985 template <class Args_01,
986 class Args_02,
987 class Args_03,
988 class Args_04,
989 class Args_05>
991 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
992 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
993 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
994 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
995 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05);
996#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 5
997
998#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 6
999 template <class Args_01,
1000 class Args_02,
1001 class Args_03,
1002 class Args_04,
1003 class Args_05,
1004 class Args_06>
1006 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1007 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1008 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1009 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1010 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1011 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06);
1012#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 6
1013
1014#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 7
1015 template <class Args_01,
1016 class Args_02,
1017 class Args_03,
1018 class Args_04,
1019 class Args_05,
1020 class Args_06,
1021 class Args_07>
1023 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1024 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1025 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1026 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1027 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1028 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
1029 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07);
1030#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 7
1031
1032#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 8
1033 template <class Args_01,
1034 class Args_02,
1035 class Args_03,
1036 class Args_04,
1037 class Args_05,
1038 class Args_06,
1039 class Args_07,
1040 class Args_08>
1042 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1043 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1044 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1045 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1046 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1047 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
1048 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
1049 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08);
1050#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 8
1051
1052#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 9
1053 template <class Args_01,
1054 class Args_02,
1055 class Args_03,
1056 class Args_04,
1057 class Args_05,
1058 class Args_06,
1059 class Args_07,
1060 class Args_08,
1061 class Args_09>
1063 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1064 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1065 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1066 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1067 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1068 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
1069 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
1070 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
1071 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09);
1072#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 9
1073
1074#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 10
1075 template <class Args_01,
1076 class Args_02,
1077 class Args_03,
1078 class Args_04,
1079 class Args_05,
1080 class Args_06,
1081 class Args_07,
1082 class Args_08,
1083 class Args_09,
1084 class Args_10>
1086 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1087 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1088 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1089 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1090 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1091 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
1092 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
1093 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
1094 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09,
1095 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) args_10);
1096#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_A >= 10
1097
1098#else
1099// The generated code below is a workaround for the absence of perfect
1100// forwarding in some compilers.
1101 template <class... Args>
1103
1104 template <class... Args>
1106 BSLS_COMPILERFEATURES_FORWARD_REF(Args)... args);
1107
1108// }}} END GENERATED CODE
1109#endif
1110
1111 /// Set the maximum load factor of this container to the specified
1112 /// `newLoadFactor`.
1113 void max_load_factor(float newLoadFactor);
1114
1115 /// Change the size of the array of buckets maintained by this container
1116 /// to at least the specified `numBuckets`, and redistribute all the
1117 /// contained elements into the new sequence of buckets, according to their hash values.
1118 ///
1119 /// \note Note that this operation has no effect if
1120 /// rehashing the elements into `numBuckets` would cause this unordered
1121 /// multiset to exceed its @ref max_load_factor .
1122 void rehash(size_type numBuckets);
1123
1124 /// Increase the number of buckets of this unordered multiset to a
1125 /// quantity such that the ratio between the specified `numElements` and this quantity does not exceed `max_load_factor`.
1126 ///
1127 /// \note Note that this
1128 /// guarantees that, after the reserve, elements can be inserted to grow
1129 /// the container to `size() == numElements` without rehashing. Also
1130 /// note that memory allocations may still occur when growing the
1131 /// container to `size() == numElements`. Also note that this operation
1132 /// has no effect if `numElements <= size()`.
1133 void reserve(size_type numElements);
1134
1135 /// Exchange the value, hasher, key-equality functor, and
1136 /// @ref max_load_factor of this object with those of the specified `other`
1137 /// object; also exchange the allocator of this object with that of
1138 /// `other` if the (template parameter) type `ALLOCATOR` has the
1139 /// @ref propagate_on_container_swap trait, and do not modify either
1140 /// allocator otherwise. This method provides the no-throw
1141 /// exception-safety guarantee if and only if both the (template
1142 /// parameter) types `HASH` and `EQUAL` provide no-throw swap
1143 /// operations; if an exception is thrown, both objects are left in
1144 /// valid but unspecified states. This operation guarantees `O[1]` complexity.
1145 ///
1146 /// \pre The behavior is undefined unless either this object was
1147 /// created with the same allocator as `other` or `ALLOCATOR` has the
1148 /// @ref propagate_on_container_swap trait.
1149 void swap(unordered_multiset& other)
1151 AllocatorTraits::is_always_equal::value
1152 && bsl::is_nothrow_swappable<HASH>::value
1153 && bsl::is_nothrow_swappable<EQUAL>::value);
1154
1155 private:
1156 // PRIVATE MANIPULATORS
1157
1158 /// Insert the values between the specified `first` and `last` into an
1159 /// initially empty unordered multiset.
1160 template <class INPUT_ITERATOR, class SENTINEL>
1161 void constructFromRange(INPUT_ITERATOR first, SENTINEL last);
1162
1163#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
1164 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
1165
1166 /// Insert the values between the specified `first` and `last` into an
1167 /// initially empty unordered multiset. The specified `numElements` is used to improve performance.
1168 ///
1169 /// \pre The behavior is undefined if the iterators
1170 /// support the calculation of distance and `numElements` is not the
1171 /// distance from `first` to `last`.
1172 template <class INPUT_ITERATOR, class SENTINEL>
1173 void constructFromRange(INPUT_ITERATOR first,
1174 SENTINEL last,
1175 size_t numElements);
1176#endif
1177
1178 /// Insert the values between the specified `first` and `last` into this
1179 /// unordered multiset.
1180 template <class INPUT_ITERATOR, class SENTINEL>
1181 void insertFromRange(INPUT_ITERATOR first, SENTINEL last);
1182
1183#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
1184 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
1185
1186 /// Insert the values between the specified `first` and `last` into this
1187 /// unordered multiset. The specified `numElements` is used to improve performance.
1188 ///
1189 /// \pre The behavior is undefined if the iterators support the
1190 /// calculation of distance and `numElements` is not the distance from
1191 /// `first` to `last`.
1192 template <class INPUT_ITERATOR, class SENTINEL>
1193 void insertFromRange(INPUT_ITERATOR first,
1194 SENTINEL last,
1195 size_t numElements);
1196#endif
1197
1198 public:
1199 // ACCESSORS
1200
1201 /// Return (a copy of) the allocator used for memory allocation by this
1202 /// unordered multiset.
1203 ALLOCATOR get_allocator() const BSLS_KEYWORD_NOEXCEPT;
1204
1206
1207 /// Return an iterator providing non-modifiable access to the first
1208 /// `value_type` object in the sequence of `value_type` objects
1209 /// maintained by this unordered multiset, or the `end` iterator if this
1210 /// unordered multiset is empty.
1212
1214
1215 /// Return an iterator providing non-modifiable access to the
1216 /// past-the-end element in the sequence of `value_type` objects
1217 /// maintained by this unordered multiset.
1219
1220 /// Return `true` if this unordered multiset contains an element whose
1221 /// key is equivalent to the specified `key`.
1222 bool contains(const key_type &key) const;
1223
1224 /// Return `true` if this unordered multiset contains an element whose
1225 /// key is equivalent to the specified `key`.
1226 template <class LOOKUP_KEY>
1227 typename enable_if<
1228 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value &&
1229 BloombergLP::bslmf::IsTransparentPredicate<EQUAL,
1230 LOOKUP_KEY>::value,
1231 bool>::type
1232 contains(const LOOKUP_KEY& key) const
1233 {
1234 // Note: implemented inline due to Sun CC compilation error
1235 return find(key) != end();
1236 }
1237
1238 /// Return `true` if this unordered multiset contains no elements, and
1239 /// `false` otherwise.
1240 bool empty() const BSLS_KEYWORD_NOEXCEPT;
1241
1242 /// Return the number of elements in this unordered multiset.
1244
1245 /// Return a theoretical upper bound on the largest number of elements that this unordered multiset could possibly hold.
1246 ///
1247 /// \note Note that there
1248 /// is no guarantee that the unordered multiset can successfully grow to
1249 /// the returned size, or even close to that size without running out of
1250 /// resources.
1252
1253 /// Return (a copy of) the key-equality binary functor that returns
1254 /// `true` if the value of two `key_type` objects are equivalent, and
1255 /// `false` otherwise.
1256 EQUAL key_eq() const;
1257
1258 /// Return (a copy of) the hash unary functor used by this unordered
1259 /// multiset to generate a hash value (of type `size_t`) for a
1260 /// `key_type` object.
1261 HASH hash_function() const;
1262
1263 /// Return an iterator providing non-modifiable access to the first
1264 /// `value_type` object in the sequence of all the value elements of
1265 /// this unordered multiset equivalent to the specified `key`, if such
1266 /// entries exist, and the past-the-end (`end`) iterator otherwise.
1267 ///
1268 /// \pre The behavior is undefined unless `key` is equivalent to the elements of
1269 /// at most one equivalent-key group in this unordered multiset.
1270 template <class LOOKUP_KEY>
1271 typename enable_if<
1272 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1273 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1274 const_iterator>::type
1275 find(const LOOKUP_KEY& key) const
1276 {
1277 // Note: implemented inline due to Sun CC compilation error.
1278 return const_iterator(d_impl.find(key));
1279 }
1280
1281 /// Return an iterator providing non-modifiable access to the first
1282 /// `value_type` object in the sequence of all the value elements of
1283 /// this unordered multiset equivalent to the specified `key`, if such
1284 /// entries exist, and the past-the-end (`end`) iterator otherwise.
1285 const_iterator find(const key_type& key) const;
1286
1287 /// Return the number of `value_type` objects within this unordered
1288 /// multiset that are equivalent to the specified `key`.
1289 ///
1290 /// \pre The behavior is undefined unless `key` is equivalent to the elements of at most
1291 /// one equivalent-key group in this unordered multiset.
1292 template <class LOOKUP_KEY>
1293 typename enable_if<
1294 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1295 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1296 size_type>::type
1297 count(const LOOKUP_KEY& key) const
1298 {
1299 // Note: implemented inline due to Sun CC compilation error.
1300 typedef ::BloombergLP::bslalg::BidirectionalNode<value_type> BNode;
1301
1302 size_type result = 0;
1303 for (HashTableLink *cursor = d_impl.find(key);
1304 cursor;
1305 ++result, cursor = cursor->nextLink()) {
1306
1307 BNode *cursorNode = static_cast<BNode *>(cursor);
1308 if (!this->key_eq()(
1309 key,
1310 ListConfiguration::extractKey(cursorNode->value()))) {
1311 break;
1312 }
1313 }
1314 return result;
1315 }
1316
1317 /// Return the number of `value_type` objects within this unordered
1318 /// multiset that are equivalent to the specified `key`.
1319 size_type count(const key_type& key) const;
1320
1321 /// Return a pair of iterators providing non-modifiable access to the
1322 /// sequence of `value_type` objects in this unordered multiset
1323 /// equivalent to the specified `key`, where the first iterator is
1324 /// positioned at the start of the sequence, and the second is
1325 /// positioned one past the end of the sequence. If this unordered
1326 /// multiset contains no `value_type` objects equivalent to the `key`,
1327 /// then the two returned iterators will have the same value.
1328 ///
1329 /// \pre The behavior is undefined unless `key` is equivalent to the elements of
1330 /// at most one equivalent-key group in this unordered multiset.
1331 template <class LOOKUP_KEY>
1332 typename enable_if<
1333 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1334 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1335 pair<const_iterator, const_iterator> >::type
1336 equal_range(const LOOKUP_KEY& key) const
1337 {
1338 // Note: implemented inline due to Sun CC compilation error.
1340 HashTableLink *first;
1341 HashTableLink *last;
1342 d_impl.findRange(&first, &last, key);
1343 return ResultType(const_iterator(first), const_iterator(last));
1344 }
1345
1346 /// Return a pair of iterators providing non-modifiable access to the
1347 /// sequence of `value_type` objects in this unordered multiset
1348 /// equivalent to the specified `key`, where the first iterator is
1349 /// positioned at the start of the sequence, and the second is
1350 /// positioned one past the end of the sequence. If this unordered
1351 /// multiset contains no `value_type` objects equivalent to the `key`,
1352 /// then the two returned iterators will have the same value.
1353 pair<const_iterator, const_iterator> equal_range(
1354 const key_type& key) const;
1355
1357
1358 /// Return a local iterator providing non-modifiable access to the first
1359 /// `value_type` object (in the sequence of `value_type` objects) of the
1360 /// bucket having the specified `index` in the array of buckets
1361 /// maintained by this unordered multiset, or the `end(index)` otherwise.
1362 ///
1363 /// \pre The behavior is undefined unless 'index <
1364 /// bucket_count()'.
1366
1367 const_local_iterator end(size_type index) const;
1368
1369 /// Return a local iterator providing non-modifiable access to the
1370 /// past-the-end element (in the sequence of `value_type` objects) of
1371 /// the bucket having the specified `index` in the array of buckets
1372 /// maintained by this unordered multiset.
1373 ///
1374 /// \pre The behavior is undefined unless `index < bucket_count()`.
1375 const_local_iterator cend(size_type index) const;
1376
1377 /// Return the index of the bucket, in the array of buckets of this
1378 /// container, where a value equivalent to the specified `key` would be
1379 /// inserted.
1380 size_type bucket(const key_type& key) const;
1381
1382 /// Return the index of the bucket, in the array of buckets of this
1383 /// container, where a value equivalent to the specified `key` would be
1384 /// inserted.
1385 ///
1386 /// Note: implemented inline due to Sun CC compilation error.
1387 template <class LOOKUP_KEY>
1388 typename enable_if<
1389 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1390 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value,
1391 size_type>::type
1392 bucket(const LOOKUP_KEY& key) const
1393 {
1394 return d_impl.bucketIndexForKey(key);
1395 }
1396
1397 /// Return the number of buckets in the array of buckets maintained by
1398 /// this unordered multiset.
1400
1401 /// Return a theoretical upper bound on the largest number of buckets that this container could possibly manage.
1402 ///
1403 /// \note Note that there is no
1404 /// guarantee that the unordered multiset can successfully grow to the
1405 /// returned size, or even close to that size without running out of
1406 /// resources.
1408
1409 /// Return the number of elements contained in the bucket at the
1410 /// specified `index` in the array of buckets maintained by this container.
1411 ///
1412 /// \pre The behavior is undefined unless 'index <
1413 /// bucket_count()'.
1414 size_type bucket_size(size_type index) const;
1415
1416 /// Return the current ratio between the `size` of this container and
1417 /// the number of buckets. The @ref load_factor is a measure of how full
1418 /// the container is, and a higher load factor leads to an increased
1419 /// number of collisions, thus resulting in a loss performance.
1420 float load_factor() const BSLS_KEYWORD_NOEXCEPT;
1421
1422 /// Return the maximum load factor allowed for this container. If an
1423 /// insert operation would cause @ref load_factor to exceed the
1424 /// @ref max_load_factor , that same insert operation will increase the
1425 /// number of buckets and rehash the elements of the container into
1426 /// those buckets the (see rehash).
1428
1429};
1430
1431#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
1432// CLASS TEMPLATE DEDUCTION GUIDES
1433
1434/// Deduce the template parameter `KEY` from the `value_type` of the
1435/// iterators supplied to the constructor of @ref unordered_multiset . Deduce
1436/// the template parameters `HASH`, `EQUAL` and `ALLOCATOR` from the other
1437/// parameters passed to the constructor. This deduction guide does not
1438/// participate unless: (1) the supplied `HASH` is invocable with a `KEY`,
1439/// (2) the supplied `EQUAL` is invocable with two `KEY`s, and (3) the
1440/// supplied allocator meets the requirements of a standard allocator.
1441template <
1442 class INPUT_ITERATOR,
1443 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1444 class HASH = bsl::hash<KEY>,
1445 class EQUAL = bsl::equal_to<KEY>,
1446 class ALLOCATOR = bsl::allocator<KEY>,
1447 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY&>>,
1448 class = bsl::enable_if_t<
1449 std::is_invocable_v<EQUAL, const KEY&, const KEY&>>,
1450 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
1451 >
1452unordered_multiset(INPUT_ITERATOR,
1453 INPUT_ITERATOR,
1454 typename bsl::allocator_traits<ALLOCATOR>::size_type = 0,
1455 HASH = HASH(),
1456 EQUAL = EQUAL(),
1457 ALLOCATOR = ALLOCATOR())
1458-> unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>;
1459
1460/// Deduce the template parameter `KEY` from the `value_type` of the
1461/// iterators supplied to the constructor of @ref unordered_multiset . Deduce
1462/// the template parameters `HASH` and `EQUAL` from the other parameters
1463/// passed to the constructor. This deduction guide does not participate
1464/// unless the supplied allocator is convertible to `bsl::allocator<KEY>`.
1465template <
1466 class INPUT_ITERATOR,
1467 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1468 class HASH,
1469 class EQUAL,
1470 class ALLOC,
1471 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1472 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1473 >
1475 INPUT_ITERATOR,
1476 INPUT_ITERATOR,
1477 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1478 HASH,
1479 EQUAL,
1480 ALLOC *)
1481-> unordered_multiset<KEY, HASH, EQUAL>;
1482
1483/// Deduce the template parameter `KEY` from the `value_type` of the
1484/// iterators supplied to the constructor of @ref unordered_multiset . Deduce
1485/// the template parameters `HASH` and `ALLOCATOR` from the other parameters
1486/// passed to the constructor. This deduction guide does not participate
1487/// unless the supplied `HASH` is invocable with a `KEY`, and the supplied
1488/// allocator meets the requirements of a standard allocator.
1489template <
1490 class INPUT_ITERATOR,
1491 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1492 class HASH,
1493 class ALLOCATOR,
1494 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
1495 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
1496 >
1497unordered_multiset(INPUT_ITERATOR,
1498 INPUT_ITERATOR,
1499 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1500 HASH,
1501 ALLOCATOR)
1502-> unordered_multiset<KEY, HASH, bsl::equal_to<KEY>, ALLOCATOR>;
1503
1504/// Deduce the template parameter `KEY` from the `value_type` of the
1505/// iterators supplied to the constructor of @ref unordered_multiset . Deduce
1506/// the template parameter `HASH` from the other parameters passed to the
1507/// constructor. This deduction guide does not participate unless the
1508/// supplied allocator is convertible to `bsl::allocator<KEY>`.
1509template <
1510 class INPUT_ITERATOR,
1511 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1512 class HASH,
1513 class ALLOC,
1514 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1515 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1516 >
1518 INPUT_ITERATOR,
1519 INPUT_ITERATOR,
1520 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1521 HASH,
1522 ALLOC *)
1523-> unordered_multiset<KEY, HASH>;
1524
1525/// Deduce the template parameter `KEY` from the `value_type` of the
1526/// iterators supplied to the constructor of @ref unordered_multiset . This
1527/// deduction guide does not participate unless the supplied allocator meets
1528/// the requirements of a standard allocator.
1529template <
1530 class INPUT_ITERATOR,
1531 class ALLOCATOR,
1532 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1533 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1534 >
1535unordered_multiset(INPUT_ITERATOR,
1536 INPUT_ITERATOR,
1537 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1538 ALLOCATOR)
1539-> unordered_multiset<KEY, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>;
1540
1541/// Deduce the template parameter `KEY` from the `value_type` of the
1542/// iterators supplied to the constructor of @ref unordered_multiset . This
1543/// deduction guide does not participate unless the supplied allocator is
1544/// convertible to `bsl::allocator<KEY>`.
1545template <
1546 class INPUT_ITERATOR,
1547 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1548 class ALLOC,
1549 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1550 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1551 >
1553 INPUT_ITERATOR,
1554 INPUT_ITERATOR,
1555 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1556 ALLOC *)
1557-> unordered_multiset<KEY>;
1558
1559/// Deduce the template parameter `KEY` from the `value_type` of the
1560/// iterators supplied to the constructor of @ref unordered_multiset . This
1561/// deduction guide does not participate unless the supplied allocator meets
1562/// the requirements of a standard allocator.
1563template <
1564 class INPUT_ITERATOR,
1565 class ALLOCATOR,
1566 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1567 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1568 >
1569unordered_multiset(INPUT_ITERATOR, INPUT_ITERATOR, ALLOCATOR)
1570-> unordered_multiset<KEY, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>;
1571
1572/// Deduce the template parameter `KEY` from the `value_type` of the
1573/// iterators supplied to the constructor of @ref unordered_multiset . This
1574/// deduction guide does not participate unless the supplied allocator is
1575/// convertible to `bsl::allocator<KEY>`.
1576template <
1577 class INPUT_ITERATOR,
1578 class KEY = BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>,
1579 class ALLOC,
1580 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1581 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1582 >
1583unordered_multiset(INPUT_ITERATOR, INPUT_ITERATOR, ALLOC *)
1584-> unordered_multiset<KEY>;
1585
1586/// Deduce the template parameter `KEY` from the `value_type` of the
1587/// initializer_list supplied to the constructor of @ref unordered_multiset .
1588/// Deduce the template parameters `HASH`, EQUAL and `ALLOCATOR` from the
1589/// other parameters passed to the constructor. This deduction guide does
1590/// not participate unless: (1) the supplied `HASH` is invocable with a
1591/// `KEY`, (2) the supplied `EQUAL` is invocable with two `KEY`s, and (3)
1592/// the supplied allocator meets the requirements of a standard allocator.
1593template <
1594 class KEY,
1595 class HASH = bsl::hash<KEY>,
1596 class EQUAL = bsl::equal_to<KEY>,
1597 class ALLOCATOR = bsl::allocator<KEY>,
1598 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY&>>,
1599 class = bsl::enable_if_t<
1600 std::is_invocable_v<EQUAL, const KEY&, const KEY&>>,
1601 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
1602 >
1603unordered_multiset(std::initializer_list<KEY>,
1604 typename bsl::allocator_traits<ALLOCATOR>::size_type = 0,
1605 HASH = HASH(),
1606 EQUAL = EQUAL(),
1607 ALLOCATOR = ALLOCATOR())
1608-> unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>;
1609
1610/// Deduce the template parameter `KEY` from the `value_type` of the
1611/// initializer_list supplied to the constructor of @ref unordered_multiset .
1612/// Deduce the template parameters `HASH` and `EQUAL` from the other
1613/// parameters passed to the constructor. This deduction guide does not
1614/// participate unless the supplied allocator is convertible to
1615/// `bsl::allocator<KEY>`.
1616template <
1617 class KEY,
1618 class HASH,
1619 class EQUAL,
1620 class ALLOC,
1621 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1622 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1623 >
1625 std::initializer_list<KEY>,
1626 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1627 HASH,
1628 EQUAL,
1629 ALLOC *)
1630-> unordered_multiset<KEY, HASH, EQUAL>;
1631
1632/// Deduce the template parameter `KEY` from the `value_type` of the
1633/// initializer_list supplied to the constructor of @ref unordered_multiset .
1634/// Deduce the template parameters `HASH` and `ALLOCATOR` from the other
1635/// parameters passed to the constructor. This deduction guide does not
1636/// participate unless the supplied `HASH` is invocable with a `KEY`, and
1637/// the supplied allocator meets the requirements of a standard allocator.
1638template <
1639 class KEY,
1640 class HASH,
1641 class ALLOCATOR,
1642 class = bsl::enable_if_t<std::is_invocable_v<HASH, const KEY &>>,
1643 class = bsl::enable_if_t< bsl::IsStdAllocator_v<ALLOCATOR>>
1644 >
1645unordered_multiset(std::initializer_list<KEY>,
1646 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1647 HASH,
1648 ALLOCATOR)
1649-> unordered_multiset<KEY, HASH, bsl::equal_to<KEY>, ALLOCATOR>;
1650
1651/// Deduce the template parameter `KEY` from the `value_type` of the
1652/// initializer_list supplied to the constructor of @ref unordered_multiset .
1653/// Deduce the template parameter `HASH` from the other parameters passed to
1654/// the constructor. This deduction guide does not participate unless the
1655/// supplied allocator is convertible to `bsl::allocator<KEY>`.
1656template <
1657 class KEY,
1658 class HASH,
1659 class ALLOC,
1660 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1661 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1662 >
1664 std::initializer_list<KEY>,
1665 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1666 HASH,
1667 ALLOC *)
1668-> unordered_multiset<KEY, HASH>;
1669
1670/// Deduce the template parameter `KEY` from the `value_type` of the
1671/// initializer_list supplied to the constructor of @ref unordered_multiset .
1672/// This deduction guide does not participate unless the supplied allocator
1673/// meets the requirements of a standard allocator.
1674template <
1675 class KEY,
1676 class ALLOCATOR,
1677 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1678 >
1679unordered_multiset(std::initializer_list<KEY>,
1680 typename bsl::allocator_traits<ALLOCATOR>::size_type,
1681 ALLOCATOR)
1682-> unordered_multiset<KEY, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>;
1683
1684/// Deduce the template parameter `KEY` from the `value_type` of the
1685/// initializer_list supplied to the constructor of @ref unordered_multiset .
1686/// This deduction guide does not participate unless the supplied allocator
1687/// is convertible to `bsl::allocator<KEY>`.
1688template <
1689 class KEY,
1690 class ALLOC,
1691 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1692 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1693 >
1695 std::initializer_list<KEY>,
1696 typename bsl::allocator_traits<DEFAULT_ALLOCATOR>::size_type,
1697 ALLOC *)
1698-> unordered_multiset<KEY>;
1699
1700/// Deduce the template parameter `KEY` from the `value_type` of the
1701/// initializer_list supplied to the constructor of @ref unordered_multiset .
1702/// This deduction guide does not participate unless the supplied allocator
1703/// meets the requirements of a standard allocator.
1704template <
1705 class KEY,
1706 class ALLOCATOR,
1707 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
1708 >
1709unordered_multiset(std::initializer_list<KEY>, ALLOCATOR)
1710-> unordered_multiset<KEY, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>;
1711
1712/// Deduce the template parameter `KEY` from the `value_type` of the
1713/// initializer_list supplied to the constructor of @ref unordered_multiset .
1714/// This deduction guide does not participate unless the supplied allocator
1715/// is convertible to `bsl::allocator<KEY>`.
1716template <
1717 class KEY,
1718 class ALLOC,
1719 class DEFAULT_ALLOCATOR = bsl::allocator<KEY>,
1720 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
1721 >
1722unordered_multiset(std::initializer_list<KEY>, ALLOC *)
1723-> unordered_multiset<KEY>;
1724#endif
1725
1726// FREE OPERATORS
1727
1728/// Return `true` if the specified `lhs` and `rhs` objects have the same
1729/// value, and `false` otherwise. Two @ref unordered_multiset objects have the
1730/// same value if they have the same number of value elements, and for each
1731/// value-element that is contained in `lhs` there is a value-element
1732/// contained in `rhs` having the same value, and vice-versa.
1733///
1734/// \note Note that this method requires that the (template parameter) type `KEY` be
1735/// `equality-comparable` (see {Requirements on `KEY`}).
1736template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1737bool operator==(const unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& lhs,
1738 const unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& rhs);
1739
1740#ifndef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
1741template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1742bool operator!=(const unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& lhs,
1743 const unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& rhs);
1744 // Return 'true' if the specified 'lhs' and 'rhs' objects do not have the
1745 // same value, and 'false' otherwise. Two @ref unordered_multiset objects do
1746 // not have the same value if they do not have the same number of
1747 // value elements, or that for some value-element contained in 'lhs' there
1748 // is not a value-element in 'rhs' having the same value, and vice-versa.
1749 // Note that this method requires that the (template parameter) type 'KEY'
1750 // and be 'equality-comparable' (see {Requirements on 'KEY'}).
1751#endif
1752
1753// FREE FUNCTIONS
1754
1755/// Erase all the elements in the specified unordered_multiset `ms` that
1756/// satisfy the specified predicate `predicate`. Return the number of
1757/// elements erased.
1758template <class KEY, class HASH, class EQUAL, class ALLOCATOR, class PREDICATE>
1759typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size_type
1760erase_if(unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& ms,
1761 PREDICATE predicate);
1762
1763template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1764void swap(unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& a,
1765 unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& b)
1767 BSLS_KEYWORD_NOEXCEPT_OPERATOR(a.swap(b)));
1768 // Exchange the value, hasher, key-equality functor, and @ref max_load_factor
1769 // of the specified 'a' object with those of the specified 'b' object; also
1770 // exchange the allocator of 'a' with that of 'b' if the (template
1771 // parameter) type 'ALLOCATOR' has the @ref propagate_on_container_swap trait,
1772 // and do not modify either allocator otherwise. This function provides
1773 // the no-throw exception-safety guarantee if and only if both the
1774 // (template parameter) types 'HASH' and 'EQUAL' provide no-throw swap
1775 // operations; if an exception is thrown, both objects are left in valid
1776 // but unspecified states. This operation guarantees 'O[1]' complexity.
1777 // The behavior is undefined unless either 'a' was created with the same
1778 // allocator as 'b' or 'ALLOCATOR' has the @ref propagate_on_container_swap
1779 // trait.
1780
1781// ============================================================================
1782// TEMPLATE AND INLINE FUNCTION DEFINITIONS
1783// ============================================================================
1784
1785 //-------------------------
1786 // class unordered_multiset
1787 //-------------------------
1788
1789// PRIVATE MANIPULATORS
1790template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1791template <class INPUT_ITERATOR, class SENTINEL>
1792inline
1793void unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::constructFromRange(
1794 INPUT_ITERATOR first,
1795 SENTINEL last)
1796{
1797 ///Implementation Notes
1798 ///--------------------
1799 // If we can calculate the number of elements, reserve space for them
1800 // upfront to reduce rehashing. The calculation is done once since
1801 // `IteratorUtil::insertDistance` may be expensive for non-random-access
1802 // iterators.
1803
1804 if (first == last) {
1805 return; // RETURN
1806 }
1807
1809 BloombergLP::bslstl::IteratorUtil::
1810 canCalculateInsertDistance<INPUT_ITERATOR,SENTINEL>()) {
1811 this->reserve(
1812 BloombergLP::bslstl::IteratorUtil::insertDistance(first, last));
1813 }
1814
1815 while (first != last) {
1816 d_impl.insert(*first);
1817 ++first;
1818 }
1819}
1820
1821#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
1822 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
1823
1824template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1825template <class INPUT_ITERATOR, class SENTINEL>
1826inline
1827void unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::constructFromRange(
1828 INPUT_ITERATOR first,
1829 SENTINEL last,
1830 size_t numElements)
1831{
1833 !BloombergLP::bslstl::IteratorUtil
1834 ::canCalculateInsertDistance<INPUT_ITERATOR, SENTINEL>()
1835 || numElements == static_cast<size_t>(
1836 BloombergLP::bslstl::IteratorUtil::insertDistance(first, last))));
1837
1838 if (0 < numElements) {
1839 this->reserve(numElements);
1840 }
1841
1842 while (first != last) {
1843 d_impl.insert(*first);
1844 ++first;
1845 }
1846}
1847
1848#endif
1849
1850template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1851template <class INPUT_ITERATOR, class SENTINEL>
1852inline
1853void unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::insertFromRange(
1854 INPUT_ITERATOR first,
1855 SENTINEL last)
1856{
1857 ///Implementation Notes
1858 ///--------------------
1859 // If we can calculate the number of elements, reserve space for them
1860 // upfront to reduce rehashing. The calculation is done once since
1861 // `IteratorUtil::insertDistance` may be expensive for non-random-access
1862 /// iterators.
1863
1864 if BSLS_KEYWORD_CONSTEXPR_CPP17 (BloombergLP::bslstl::IteratorUtil
1865 ::canCalculateInsertDistance<INPUT_ITERATOR, SENTINEL>()) {
1866 this->reserve(this->size()
1867 + BloombergLP::bslstl::IteratorUtil::insertDistance(first, last));
1868 }
1869
1870 while (first != last) {
1871 d_impl.insert(*first);
1872 ++first;
1873 }
1874}
1875
1876#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
1877 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
1878
1879template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1880template <class INPUT_ITERATOR, class SENTINEL>
1881inline
1882void unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::insertFromRange(
1883 INPUT_ITERATOR first,
1884 SENTINEL last,
1885 size_t numElements)
1886{
1888 !BloombergLP::bslstl::IteratorUtil
1889 ::canCalculateInsertDistance<INPUT_ITERATOR, SENTINEL>()
1890 || numElements == static_cast<size_t>(
1891 BloombergLP::bslstl::IteratorUtil::insertDistance(first, last))));
1892
1893 this->reserve(this->size() + numElements);
1894
1895 while (first != last) {
1896 d_impl.insert(*first);
1897 ++first;
1898 }
1899}
1900
1901#endif
1902
1903// CREATORS
1904template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1905inline
1907: d_impl(HASH(), EQUAL(), 0, 1.0f, ALLOCATOR())
1908{
1909}
1910
1911template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1912inline
1913unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1914 size_type initialNumBuckets,
1915 const HASH& hashFunction,
1916 const EQUAL& keyEqual,
1917 const ALLOCATOR& basicAllocator)
1918: d_impl(hashFunction, keyEqual, initialNumBuckets, 1.0f, basicAllocator)
1919{
1920}
1921
1922template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1923inline
1924unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1925 size_type initialNumBuckets,
1926 const HASH& hashFunction,
1927 const ALLOCATOR& basicAllocator)
1928: d_impl(hashFunction, EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
1929{
1930}
1931
1932template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1933inline
1934unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1935 size_type initialNumBuckets,
1936 const ALLOCATOR& basicAllocator)
1937: d_impl(HASH(), EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
1938{
1939}
1940
1941template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1942inline
1943unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1944 const ALLOCATOR& basicAllocator)
1945: d_impl(basicAllocator)
1946{
1947}
1948
1949template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1950inline
1951unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1952 const unordered_multiset& original)
1953: d_impl(original.d_impl,
1954 AllocatorTraits::select_on_container_copy_construction(
1955 original.get_allocator()))
1956{
1957}
1958
1959template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1960inline
1961unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1962 BloombergLP::bslmf::MovableRef<unordered_multiset> original)
1963: d_impl(MoveUtil::move(MoveUtil::access(original).d_impl))
1964{
1965}
1966
1967template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1968inline
1969unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1970 const unordered_multiset& original,
1971 const typename type_identity<ALLOCATOR>::type& basicAllocator)
1972: d_impl(original.d_impl, basicAllocator)
1973{
1974}
1975
1976template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1977inline
1978unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1979 BloombergLP::bslmf::MovableRef<unordered_multiset> original,
1980 const typename type_identity<ALLOCATOR>::type& basicAllocator)
1981: d_impl(MoveUtil::move(MoveUtil::access(original).d_impl), basicAllocator)
1982{
1983}
1984
1985template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
1986template <class INPUT_ITERATOR>
1987inline
1988unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
1989 INPUT_ITERATOR first,
1990 INPUT_ITERATOR last,
1991 size_type initialNumBuckets,
1992 const HASH& hashFunction,
1993 const EQUAL& keyEqual,
1994 const ALLOCATOR& basicAllocator)
1995: d_impl(hashFunction, keyEqual, initialNumBuckets, 1.0f, basicAllocator)
1996{
1997 constructFromRange(first, last);
1998}
1999
2000template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2001template <class INPUT_ITERATOR>
2002inline
2003unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
2004 INPUT_ITERATOR first,
2005 INPUT_ITERATOR last,
2006 size_type initialNumBuckets,
2007 const HASH& hashFunction,
2008 const ALLOCATOR& basicAllocator)
2009: d_impl(hashFunction, EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
2010{
2011 this->insert(first, last);
2012}
2013
2014template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2015template <class INPUT_ITERATOR>
2016inline
2017unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
2018 INPUT_ITERATOR first,
2019 INPUT_ITERATOR last,
2020 size_type initialNumBuckets,
2021 const ALLOCATOR& basicAllocator)
2022: d_impl(HASH(), EQUAL(), initialNumBuckets, 1.0f, basicAllocator)
2023{
2024 this->insert(first, last);
2025}
2026
2027template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2028template <class INPUT_ITERATOR>
2029inline
2030unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
2031 INPUT_ITERATOR first,
2032 INPUT_ITERATOR last,
2033 const ALLOCATOR& basicAllocator)
2034: d_impl(HASH(), EQUAL(), 0, 1.0f, basicAllocator)
2035{
2036 this->insert(first, last);
2037}
2038
2039#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2040template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2041#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
2042template <class, class, class>
2043#endif
2044inline
2045unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
2046 std::initializer_list<KEY> values,
2047 size_type initialNumBuckets,
2048 const hasher& hashFunction,
2049 const key_equal& keyEqual,
2050 const ALLOCATOR& basicAllocator)
2051: unordered_multiset(values.begin(),
2052 values.end(),
2053 initialNumBuckets,
2054 hashFunction,
2055 keyEqual,
2056 basicAllocator)
2057{
2058}
2059
2060template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2061#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
2062template <class, class>
2063#endif
2064inline
2065unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
2066 std::initializer_list<KEY> values,
2067 size_type initialNumBuckets,
2068 const HASH& hashFunction,
2069 const ALLOCATOR& basicAllocator)
2070: unordered_multiset(values.begin(),
2071 values.end(),
2072 initialNumBuckets,
2073 hashFunction,
2074 EQUAL(),
2075 basicAllocator)
2076{
2077}
2078
2079template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2080#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
2081template <class>
2082#endif
2083inline
2084unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
2085 std::initializer_list<KEY> values,
2086 size_type initialNumBuckets,
2087 const ALLOCATOR& basicAllocator)
2088: unordered_multiset(values.begin(),
2089 values.end(),
2090 initialNumBuckets,
2091 HASH(),
2092 EQUAL(),
2093 basicAllocator)
2094{
2095}
2096
2097template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2098#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
2099template <class>
2100#endif
2101inline
2102unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::unordered_multiset(
2103 std::initializer_list<KEY> values,
2104 const ALLOCATOR& basicAllocator)
2105: unordered_multiset(values.begin(),
2106 values.end(),
2107 0,
2108 HASH(),
2109 EQUAL(),
2110 basicAllocator)
2111{
2112}
2113#endif // defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2114
2115template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2116inline
2117unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::~unordered_multiset()
2118{
2119 // All memory management is handled by the base 'd_impl' member.
2120}
2121
2122// MANIPULATORS
2123template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2124inline
2125unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>&
2126unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::operator=(
2127 const unordered_multiset& rhs)
2128{
2129 // Note that we have delegated responsibility for correct handling of
2130 // allocator propagation to the 'HashTable' implementation.
2131
2132 d_impl = rhs.d_impl;
2133
2134 return *this;
2135}
2136
2137template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2138inline
2139unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>&
2140unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::operator=(
2141 BloombergLP::bslmf::MovableRef<unordered_multiset> rhs)
2143 AllocatorTraits::is_always_equal::value
2144 && std::is_nothrow_move_assignable<HASH>::value
2145 && std::is_nothrow_move_assignable<EQUAL>::value)
2146{
2147 // Note that we have delegated responsibility for correct handling of
2148 // allocator propagation to the 'HashTable' implementation.
2149
2150 unordered_multiset& lvalue = rhs;
2151
2152 d_impl = MoveUtil::move(lvalue.d_impl);
2153
2154 return *this;
2155}
2156
2157#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2158template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2159inline
2160unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>&
2161unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::operator=(
2162 std::initializer_list<KEY> values)
2163{
2164 unordered_multiset tmp(values, d_impl.allocator());
2165
2166 d_impl.swap(tmp.d_impl);
2167
2168 return *this;
2169}
2170#endif
2171
2172#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
2173// {{{ BEGIN GENERATED CODE
2174// Command line: sim_cpp11_features.pl bslstl_unorderedmultiset.h
2175#ifndef BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT
2176#define BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT 10
2177#endif
2178#ifndef BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B
2179#define BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT
2180#endif
2181#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 0
2182template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2183inline
2184typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2185unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2186 )
2187{
2188 return iterator(d_impl.emplace(
2189 ));
2190
2191}
2192#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 0
2193
2194#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 1
2195template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2196template <class Args_01>
2197inline
2198typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2199unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2200 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01)
2201{
2202 return iterator(d_impl.emplace(
2203 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01)));
2204
2205}
2206#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 1
2207
2208#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 2
2209template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2210template <class Args_01,
2211 class Args_02>
2212inline
2213typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2214unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2215 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
2216 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02)
2217{
2218 return iterator(d_impl.emplace(
2219 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
2220 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02)));
2221
2222}
2223#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 2
2224
2225#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 3
2226template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2227template <class Args_01,
2228 class Args_02,
2229 class Args_03>
2230inline
2231typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2232unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2233 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
2234 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
2235 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03)
2236{
2237 return iterator(d_impl.emplace(
2238 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
2239 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
2240 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03)));
2241
2242}
2243#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 3
2244
2245#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 4
2246template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2247template <class Args_01,
2248 class Args_02,
2249 class Args_03,
2250 class Args_04>
2251inline
2252typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2253unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2254 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
2255 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
2256 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
2257 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04)
2258{
2259 return iterator(d_impl.emplace(
2260 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
2261 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
2262 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
2263 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04)));
2264
2265}
2266#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 4
2267
2268#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 5
2269template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2270template <class Args_01,
2271 class Args_02,
2272 class Args_03,
2273 class Args_04,
2274 class Args_05>
2275inline
2276typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2277unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2278 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
2279 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
2280 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
2281 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
2282 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05)
2283{
2284 return iterator(d_impl.emplace(
2285 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
2286 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
2287 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
2288 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
2289 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05)));
2290
2291}
2292#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 5
2293
2294#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 6
2295template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2296template <class Args_01,
2297 class Args_02,
2298 class Args_03,
2299 class Args_04,
2300 class Args_05,
2301 class Args_06>
2302inline
2303typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2304unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2305 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
2306 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
2307 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
2308 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
2309 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
2310 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06)
2311{
2312 return iterator(d_impl.emplace(
2313 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
2314 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
2315 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
2316 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
2317 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
2318 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06)));
2319
2320}
2321#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 6
2322
2323#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 7
2324template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2325template <class Args_01,
2326 class Args_02,
2327 class Args_03,
2328 class Args_04,
2329 class Args_05,
2330 class Args_06,
2331 class Args_07>
2332inline
2333typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2334unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2335 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
2336 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
2337 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
2338 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
2339 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
2340 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
2341 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07)
2342{
2343 return iterator(d_impl.emplace(
2344 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
2345 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
2346 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
2347 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
2348 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
2349 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06),
2350 BSLS_COMPILERFEATURES_FORWARD(Args_07, arguments_07)));
2351
2352}
2353#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 7
2354
2355#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 8
2356template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2357template <class Args_01,
2358 class Args_02,
2359 class Args_03,
2360 class Args_04,
2361 class Args_05,
2362 class Args_06,
2363 class Args_07,
2364 class Args_08>
2365inline
2366typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2367unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2368 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
2369 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
2370 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
2371 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
2372 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
2373 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
2374 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07,
2375 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) arguments_08)
2376{
2377 return iterator(d_impl.emplace(
2378 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
2379 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
2380 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
2381 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
2382 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
2383 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06),
2384 BSLS_COMPILERFEATURES_FORWARD(Args_07, arguments_07),
2385 BSLS_COMPILERFEATURES_FORWARD(Args_08, arguments_08)));
2386
2387}
2388#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 8
2389
2390#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 9
2391template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2392template <class Args_01,
2393 class Args_02,
2394 class Args_03,
2395 class Args_04,
2396 class Args_05,
2397 class Args_06,
2398 class Args_07,
2399 class Args_08,
2400 class Args_09>
2401inline
2402typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2403unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2404 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
2405 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
2406 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
2407 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
2408 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
2409 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
2410 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07,
2411 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) arguments_08,
2412 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) arguments_09)
2413{
2414 return iterator(d_impl.emplace(
2415 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
2416 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
2417 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
2418 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
2419 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
2420 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06),
2421 BSLS_COMPILERFEATURES_FORWARD(Args_07, arguments_07),
2422 BSLS_COMPILERFEATURES_FORWARD(Args_08, arguments_08),
2423 BSLS_COMPILERFEATURES_FORWARD(Args_09, arguments_09)));
2424
2425}
2426#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 9
2427
2428#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 10
2429template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2430template <class Args_01,
2431 class Args_02,
2432 class Args_03,
2433 class Args_04,
2434 class Args_05,
2435 class Args_06,
2436 class Args_07,
2437 class Args_08,
2438 class Args_09,
2439 class Args_10>
2440inline
2441typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2442unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2443 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
2444 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
2445 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
2446 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
2447 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
2448 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
2449 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07,
2450 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) arguments_08,
2451 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) arguments_09,
2452 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) arguments_10)
2453{
2454 return iterator(d_impl.emplace(
2455 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
2456 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
2457 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
2458 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
2459 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
2460 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06),
2461 BSLS_COMPILERFEATURES_FORWARD(Args_07, arguments_07),
2462 BSLS_COMPILERFEATURES_FORWARD(Args_08, arguments_08),
2463 BSLS_COMPILERFEATURES_FORWARD(Args_09, arguments_09),
2464 BSLS_COMPILERFEATURES_FORWARD(Args_10, arguments_10)));
2465
2466}
2467#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 10
2468
2469
2470#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 0
2471template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2472inline
2473typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2474unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2475 const_iterator hint)
2476{
2477 return iterator(d_impl.emplaceWithHint(hint.node()));
2478}
2479#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 0
2480
2481#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 1
2482template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2483template <class Args_01>
2484inline
2485typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2486unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2487 const_iterator hint,
2488 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01)
2489{
2490 return iterator(d_impl.emplaceWithHint(hint.node(),
2491 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01)));
2492}
2493#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 1
2494
2495#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 2
2496template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2497template <class Args_01,
2498 class Args_02>
2499inline
2500typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2501unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2502 const_iterator hint,
2503 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
2504 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02)
2505{
2506 return iterator(d_impl.emplaceWithHint(hint.node(),
2507 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
2508 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02)));
2509}
2510#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 2
2511
2512#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 3
2513template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2514template <class Args_01,
2515 class Args_02,
2516 class Args_03>
2517inline
2518typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2519unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2520 const_iterator hint,
2521 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
2522 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
2523 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03)
2524{
2525 return iterator(d_impl.emplaceWithHint(hint.node(),
2526 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
2527 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
2528 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03)));
2529}
2530#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 3
2531
2532#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 4
2533template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2534template <class Args_01,
2535 class Args_02,
2536 class Args_03,
2537 class Args_04>
2538inline
2539typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2540unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2541 const_iterator hint,
2542 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
2543 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
2544 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
2545 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04)
2546{
2547 return iterator(d_impl.emplaceWithHint(hint.node(),
2548 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
2549 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
2550 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
2551 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04)));
2552}
2553#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 4
2554
2555#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 5
2556template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2557template <class Args_01,
2558 class Args_02,
2559 class Args_03,
2560 class Args_04,
2561 class Args_05>
2562inline
2563typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2564unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2565 const_iterator hint,
2566 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
2567 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
2568 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
2569 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
2570 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05)
2571{
2572 return iterator(d_impl.emplaceWithHint(hint.node(),
2573 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
2574 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
2575 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
2576 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
2577 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05)));
2578}
2579#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 5
2580
2581#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 6
2582template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2583template <class Args_01,
2584 class Args_02,
2585 class Args_03,
2586 class Args_04,
2587 class Args_05,
2588 class Args_06>
2589inline
2590typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2591unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2592 const_iterator hint,
2593 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
2594 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
2595 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
2596 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
2597 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
2598 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06)
2599{
2600 return iterator(d_impl.emplaceWithHint(hint.node(),
2601 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
2602 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
2603 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
2604 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
2605 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
2606 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06)));
2607}
2608#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 6
2609
2610#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 7
2611template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2612template <class Args_01,
2613 class Args_02,
2614 class Args_03,
2615 class Args_04,
2616 class Args_05,
2617 class Args_06,
2618 class Args_07>
2619inline
2620typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2621unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2622 const_iterator hint,
2623 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
2624 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
2625 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
2626 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
2627 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
2628 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
2629 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07)
2630{
2631 return iterator(d_impl.emplaceWithHint(hint.node(),
2632 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
2633 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
2634 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
2635 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
2636 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
2637 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06),
2638 BSLS_COMPILERFEATURES_FORWARD(Args_07, arguments_07)));
2639}
2640#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 7
2641
2642#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 8
2643template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2644template <class Args_01,
2645 class Args_02,
2646 class Args_03,
2647 class Args_04,
2648 class Args_05,
2649 class Args_06,
2650 class Args_07,
2651 class Args_08>
2652inline
2653typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2654unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2655 const_iterator hint,
2656 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
2657 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
2658 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
2659 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
2660 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
2661 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
2662 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07,
2663 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) arguments_08)
2664{
2665 return iterator(d_impl.emplaceWithHint(hint.node(),
2666 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
2667 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
2668 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
2669 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
2670 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
2671 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06),
2672 BSLS_COMPILERFEATURES_FORWARD(Args_07, arguments_07),
2673 BSLS_COMPILERFEATURES_FORWARD(Args_08, arguments_08)));
2674}
2675#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 8
2676
2677#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 9
2678template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2679template <class Args_01,
2680 class Args_02,
2681 class Args_03,
2682 class Args_04,
2683 class Args_05,
2684 class Args_06,
2685 class Args_07,
2686 class Args_08,
2687 class Args_09>
2688inline
2689typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2690unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2691 const_iterator hint,
2692 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
2693 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
2694 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
2695 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
2696 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
2697 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
2698 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07,
2699 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) arguments_08,
2700 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) arguments_09)
2701{
2702 return iterator(d_impl.emplaceWithHint(hint.node(),
2703 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
2704 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
2705 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
2706 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
2707 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
2708 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06),
2709 BSLS_COMPILERFEATURES_FORWARD(Args_07, arguments_07),
2710 BSLS_COMPILERFEATURES_FORWARD(Args_08, arguments_08),
2711 BSLS_COMPILERFEATURES_FORWARD(Args_09, arguments_09)));
2712}
2713#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 9
2714
2715#if BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 10
2716template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2717template <class Args_01,
2718 class Args_02,
2719 class Args_03,
2720 class Args_04,
2721 class Args_05,
2722 class Args_06,
2723 class Args_07,
2724 class Args_08,
2725 class Args_09,
2726 class Args_10>
2727inline
2728typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2729unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2730 const_iterator hint,
2731 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) arguments_01,
2732 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) arguments_02,
2733 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) arguments_03,
2734 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) arguments_04,
2735 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) arguments_05,
2736 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) arguments_06,
2737 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) arguments_07,
2738 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) arguments_08,
2739 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) arguments_09,
2740 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) arguments_10)
2741{
2742 return iterator(d_impl.emplaceWithHint(hint.node(),
2743 BSLS_COMPILERFEATURES_FORWARD(Args_01, arguments_01),
2744 BSLS_COMPILERFEATURES_FORWARD(Args_02, arguments_02),
2745 BSLS_COMPILERFEATURES_FORWARD(Args_03, arguments_03),
2746 BSLS_COMPILERFEATURES_FORWARD(Args_04, arguments_04),
2747 BSLS_COMPILERFEATURES_FORWARD(Args_05, arguments_05),
2748 BSLS_COMPILERFEATURES_FORWARD(Args_06, arguments_06),
2749 BSLS_COMPILERFEATURES_FORWARD(Args_07, arguments_07),
2750 BSLS_COMPILERFEATURES_FORWARD(Args_08, arguments_08),
2751 BSLS_COMPILERFEATURES_FORWARD(Args_09, arguments_09),
2752 BSLS_COMPILERFEATURES_FORWARD(Args_10, arguments_10)));
2753}
2754#endif // BSLSTL_UNORDEREDMULTISET_VARIADIC_LIMIT_B >= 10
2755
2756#else
2757// The generated code below is a workaround for the absence of perfect
2758// forwarding in some compilers.
2759template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2760template <class... Args>
2761inline
2762typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2763unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace(
2764 BSLS_COMPILERFEATURES_FORWARD_REF(Args)... arguments)
2765{
2766 return iterator(d_impl.emplace(
2767 BSLS_COMPILERFEATURES_FORWARD(Args, arguments)...));
2768
2769}
2770
2771template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2772template <class... Args>
2773inline
2774typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2775unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::emplace_hint(
2776 const_iterator hint,
2777 BSLS_COMPILERFEATURES_FORWARD_REF(Args)... arguments)
2778{
2779 return iterator(d_impl.emplaceWithHint(hint.node(),
2780 BSLS_COMPILERFEATURES_FORWARD(Args, arguments)...));
2781}
2782// }}} END GENERATED CODE
2783#endif
2784
2785template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2786inline
2787typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2788unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::begin() BSLS_KEYWORD_NOEXCEPT
2789{
2790 return iterator(d_impl.elementListRoot());
2791}
2792
2793template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2794inline
2795typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2796unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::end() BSLS_KEYWORD_NOEXCEPT
2797{
2798 return iterator();
2799}
2800
2801template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2802inline
2803typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::local_iterator
2804unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::begin(size_type index)
2805{
2806 BSLS_ASSERT_SAFE(index < this->bucket_count());
2807
2808 return local_iterator(&d_impl.bucketAtIndex(index));
2809}
2810
2811template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2812inline
2813typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::local_iterator
2814unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::end(size_type index)
2815{
2816 BSLS_ASSERT_SAFE(index < this->bucket_count());
2817
2818 return local_iterator(0, &d_impl.bucketAtIndex(index));
2819}
2820
2821template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2822inline
2823void
2824unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::clear() BSLS_KEYWORD_NOEXCEPT
2825{
2826 d_impl.removeAll();
2827}
2828
2829template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2830typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2831unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::find(const key_type& key)
2832{
2833 return iterator(d_impl.find(key));
2834}
2835
2836template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2837inline
2839 typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator>
2840unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::equal_range(
2841 const key_type& key)
2842{
2843 HashTableLink *first;
2844 HashTableLink *last;
2845 d_impl.findRange(&first, &last, key);
2846 return bsl::pair<iterator, iterator>(iterator(first), iterator(last));
2847}
2848
2849template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2850inline
2851typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2852unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::erase(const_iterator position)
2853{
2854 BSLS_ASSERT(position != this->end());
2855
2856 return iterator(d_impl.remove(position.node()));
2857}
2858
2859template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2860typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size_type
2861unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::erase(const key_type& key)
2862{
2863 typedef ::BloombergLP::bslalg::BidirectionalNode<value_type> BNode;
2864
2865 HashTableLink *target = d_impl.find(key);
2866 if (target) {
2867 target = d_impl.remove(target);
2868 size_type result = 1;
2869 while (target &&
2870 this->key_eq()(key, ListConfiguration::extractKey(
2871 static_cast<BNode *>(target)->value()))) {
2872 target = d_impl.remove(target);
2873 ++result;
2874 }
2875 return result; // RETURN
2876 }
2877
2878 return 0;
2879}
2880
2881template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2882typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2883unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::erase(const_iterator first,
2884 const_iterator last)
2885{
2886
2887#if defined BDE_BUILD_TARGET_SAFE_2
2888 if (first != last) {
2889 iterator it = this->begin();
2890 const iterator end = this->end();
2891 for (; it != first; ++it) {
2892 BSLS_ASSERT(last != it);
2893 BSLS_ASSERT(end != it);
2894 }
2895 for (; it != last; ++it) {
2896 BSLS_ASSERT(end != it);
2897 }
2898 }
2899#endif
2900
2901 while (first != last) {
2902 first = this->erase(first);
2903 }
2904
2905 return iterator(first.node()); // convert from const_iterator
2906}
2907
2908template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2909inline
2910typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2911unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::insert(
2912 const value_type& value)
2913{
2914 return iterator(d_impl.insert(value));
2915}
2916
2917template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2918inline
2919typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2920unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::insert(
2921 BloombergLP::bslmf::MovableRef<value_type> value)
2922{
2923 return iterator(d_impl.insert(MoveUtil::move(value)));
2924}
2925
2926template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2927inline
2928typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2929unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::insert(
2930 const_iterator hint,
2931 const value_type& value)
2932{
2933 return iterator(d_impl.insert(value, hint.node()));
2934}
2935
2936template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2937inline
2938typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::iterator
2939unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::insert(
2940 const_iterator hint,
2941 BloombergLP::bslmf::MovableRef<value_type> value)
2942{
2943 return iterator(d_impl.insert(MoveUtil::move(value), hint.node()));
2944}
2945
2946template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2947template <class INPUT_ITERATOR>
2948void
2949unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::insert(INPUT_ITERATOR first,
2950 INPUT_ITERATOR last)
2951{
2952 insertFromRange(first, last);
2953}
2954
2955#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2956template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2957inline
2958void unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::insert(
2959 std::initializer_list<KEY> values)
2960{
2961 insert(values.begin(), values.end());
2962}
2963#endif
2964
2965template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2966inline
2967void unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::max_load_factor(
2968 float newLoadFactor)
2969{
2970 d_impl.setMaxLoadFactor(newLoadFactor);
2971}
2972
2973template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2974inline
2975void
2976unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::rehash(size_type numBuckets)
2977{
2978 d_impl.rehashForNumBuckets(numBuckets);
2979}
2980
2981template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2982inline
2983void
2984unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::reserve(size_type numElements)
2985{
2986 d_impl.reserveForNumElements(numElements);
2987}
2988
2989template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
2990inline
2991void
2992unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::swap(
2993 unordered_multiset& other)
2995 AllocatorTraits::is_always_equal::value
2996 && bsl::is_nothrow_swappable<HASH>::value
2997 && bsl::is_nothrow_swappable<EQUAL>::value)
2998{
2999 d_impl.swap(other.d_impl);
3000}
3001
3002// ACCESSORS
3003template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3004inline
3005ALLOCATOR
3006unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::get_allocator() const
3008{
3009 return d_impl.allocator();
3010}
3011
3012template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3013inline
3014typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator
3015unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::begin() const
3017{
3018 return const_iterator(d_impl.elementListRoot());
3019}
3020
3021template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3022inline
3023typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator
3024unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::end() const
3026{
3027 return const_iterator();
3028}
3029
3030template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3031inline
3032typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator
3033unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::cbegin() const
3035{
3036 return const_iterator(d_impl.elementListRoot());
3037}
3038
3039template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3040inline
3041typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator
3042unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::cend() const
3044{
3045 return const_iterator();
3046}
3047
3048template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3049inline
3050typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_local_iterator
3051unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::begin(size_type index) const
3052{
3053 BSLS_ASSERT_SAFE(index < this->bucket_count());
3054
3055 return const_local_iterator(&d_impl.bucketAtIndex(index));
3056}
3057
3058template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3059inline
3060typename
3061 unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_local_iterator
3062unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::end(size_type index) const
3063{
3064 BSLS_ASSERT_SAFE(index < this->bucket_count());
3065
3066 return const_local_iterator(0, &d_impl.bucketAtIndex(index));
3067}
3068
3069template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3070inline
3071typename
3072 unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_local_iterator
3073unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::cbegin(size_type index) const
3074{
3075 BSLS_ASSERT_SAFE(index < this->bucket_count());
3076
3077 return const_local_iterator(&d_impl.bucketAtIndex(index));
3078}
3079
3080template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3081inline
3082typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_local_iterator
3083unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::cend(size_type index) const
3084{
3085 BSLS_ASSERT_SAFE(index < this->bucket_count());
3086
3087 return const_local_iterator(0, &d_impl.bucketAtIndex(index));
3088}
3089
3090template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3091inline
3092typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size_type
3093unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::bucket(
3094 const key_type& key) const
3095{
3096 return d_impl.bucketIndexForKey(key);
3097}
3098
3099template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3100inline
3101typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size_type
3102unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::bucket_count() const
3104{
3105 return d_impl.numBuckets();
3106}
3107
3108template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3109inline
3110typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size_type
3111unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::bucket_size(
3112 size_type index) const
3113{
3114 BSLS_ASSERT_SAFE(index < this->bucket_count());
3115
3116 return d_impl.countElementsInBucket(index);
3117}
3118
3119template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3120typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size_type
3121unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::count(
3122 const key_type& key) const
3123{
3124 typedef ::BloombergLP::bslalg::BidirectionalNode<value_type> BNode;
3125
3126 size_type result = 0;
3127 for (HashTableLink *cursor = d_impl.find(key);
3128 cursor;
3129 ++result, cursor = cursor->nextLink()) {
3130
3131 BNode *cursorNode = static_cast<BNode *>(cursor);
3132 if (!this->key_eq()(
3133 key,
3134 ListConfiguration::extractKey(cursorNode->value()))) {
3135 break;
3136 }
3137 }
3138 return result;
3139}
3140
3141template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3142inline
3143typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator
3144unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::find(
3145 const key_type& key) const
3146{
3147 return const_iterator(d_impl.find(key));
3148}
3149
3150template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3151inline
3152bool unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::contains(
3153 const key_type& key) const
3154{
3155 return find(key) != end();
3156}
3157
3158template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3159inline
3160bool
3161unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::empty() const
3163{
3164 return 0 == d_impl.size();
3165}
3166
3167template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3168inline
3169typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size_type
3170unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size() const
3172{
3173 return d_impl.size();
3174}
3175
3176template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3177inline
3178typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size_type
3179unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::max_size() const
3181{
3182 return AllocatorTraits::max_size(get_allocator());
3183}
3184
3185template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3186inline
3187typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::hasher
3188unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::hash_function() const
3189{
3190 return d_impl.hasher();
3191}
3192
3193template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3194inline
3195typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::key_equal
3196unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::key_eq() const
3197{
3198 return d_impl.comparator();
3199}
3200
3201template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3202inline
3203bsl::pair<
3204 typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator,
3205 typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::const_iterator>
3206unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::equal_range(
3207 const key_type& key) const
3208{
3209 HashTableLink *first;
3210 HashTableLink *last;
3211 d_impl.findRange(&first, &last, key);
3212 return bsl::pair<const_iterator, const_iterator>(const_iterator(first),
3213 const_iterator(last));
3214}
3215
3216template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3217inline
3218typename unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::size_type
3219unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::max_bucket_count() const
3221{
3222 return d_impl.maxNumBuckets();
3223}
3224
3225template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3226inline
3227float unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::load_factor() const
3229{
3230 return d_impl.loadFactor();
3231}
3232
3233template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3234inline
3235float unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>::max_load_factor() const
3237{
3238 return d_impl.maxLoadFactor();
3239}
3240
3241} // close namespace bsl
3242
3243// FREE OPERATORS
3244template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3245inline
3246bool bsl::operator==(
3249{
3250 return lhs.d_impl == rhs.d_impl;
3251}
3252
3253#ifndef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
3254template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3255inline
3256bool bsl::operator!=(
3259{
3260 return !(lhs == rhs);
3261}
3262#endif
3263
3264// FREE FUNCTIONS
3265template <class KEY, class HASH, class EQUAL, class ALLOCATOR, class PREDICATE>
3266inline
3268bsl::erase_if(unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& ms,
3269 PREDICATE predicate)
3270{
3271 return BloombergLP::bslstl::AlgorithmUtil::containerEraseIf(ms, predicate);
3272}
3273
3274template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3275inline
3276void
3281{
3282 a.swap(b);
3283}
3284
3285// ============================================================================
3286// TYPE TRAITS
3287// ============================================================================
3288
3289// Type traits for STL *unordered* *associative* containers:
3290//: o An unordered associative container defines STL iterators.
3291//: o An unordered associative container is bitwise movable if both functors
3292//: and the allocator are bitwise movable.
3293//: o An unordered associative container uses 'bslma' allocators if the
3294//: (template parameter) type 'ALLOCATOR' is convertible from
3295//: 'bslma::Allocator *'.
3296
3297
3298
3299namespace bslalg {
3300
3301template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3302struct HasStlIterators<bsl::unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR> >
3304{};
3305
3306} // close namespace bslalg
3307
3308namespace bslma {
3309
3310template <class KEY, class HASH, class EQUAL, class ALLOCATOR>
3311struct UsesBslmaAllocator<bsl::unordered_multiset<KEY,
3312 HASH,
3313 EQUAL,
3314 ALLOCATOR> >
3315 : bsl::is_convertible<Allocator*, ALLOCATOR>::type
3316{};
3317
3318} // close namespace bslma
3319
3320
3321
3322#else // if ! defined(DEFINED_BSLSTL_UNORDEREDMULTISET_H)
3323# error Not valid except when included from bslstl_unorderedmultiset.h
3324#endif // ! defined(COMPILING_BSLSTL_UNORDEREDMULTISET_H)
3325
3326#endif // ! defined(INCLUDED_BSLSTL_UNORDEREDMULTISET_CPP03)
3327
3328// ----------------------------------------------------------------------------
3329// Copyright 2013 Bloomberg Finance L.P.
3330//
3331// Licensed under the Apache License, Version 2.0 (the "License");
3332// you may not use this file except in compliance with the License.
3333// You may obtain a copy of the License at
3334//
3335// http://www.apache.org/licenses/LICENSE-2.0
3336//
3337// Unless required by applicable law or agreed to in writing, software
3338// distributed under the License is distributed on an "AS IS" BASIS,
3339// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3340// See the License for the specific language governing permissions and
3341// limitations under the License.
3342// ----------------------------- END-OF-FILE ----------------------------------
3343
3344/** @} */
3345/** @} */
3346/** @} */
#define BSLMF_NESTED_TRAIT_DECLARATION_IF(t_TYPE, t_TRAIT, t_COND)
Definition bslmf_nestedtraitdeclaration.h:243
Definition bslma_bslallocator.h:588
Definition bslstl_pair.h:1280
Definition bslstl_unorderedmultiset.h:801
void clear() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:2666
void reserve(size_type numElements)
Definition bslstl_unorderedmultiset.h:2826
size_type bucket_count() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:2944
const value_type & const_reference
Definition bslstl_unorderedmultiset.h:854
friend bool operator==(const unordered_multiset< KEY2, HASH2, EQUAL2, ALLOCATOR2 > &, const unordered_multiset< KEY2, HASH2, EQUAL2, ALLOCATOR2 > &)
::BloombergLP::bslstl::HashTableIterator< const value_type, difference_type > iterator
Definition bslstl_unorderedmultiset.h:862
KEY value_type
Definition bslstl_unorderedmultiset.h:849
AllocatorTraits::const_pointer const_pointer
Definition bslstl_unorderedmultiset.h:859
size_type bucket_size(size_type index) const
Definition bslstl_unorderedmultiset.h:2953
size_type bucket(const key_type &key) const
Definition bslstl_unorderedmultiset.h:2935
AllocatorTraits::difference_type difference_type
Definition bslstl_unorderedmultiset.h:857
size_type max_bucket_count() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:3061
iterator const_iterator
Definition bslstl_unorderedmultiset.h:867
local_iterator const_local_iterator
Definition bslstl_unorderedmultiset.h:868
EQUAL key_eq() const
Definition bslstl_unorderedmultiset.h:3038
HASH hash_function() const
Definition bslstl_unorderedmultiset.h:3030
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_unorderedmultiset.h:1380
iterator end() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:2638
size_type max_size() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:3021
unordered_multiset &operator=(BloombergLP::bslmf::MovableRef< unordered_multiset > rhs) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits iterator begin() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:2630
bool empty() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:3003
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_unorderedmultiset.h:1292
size_type erase(const key_type &key)
Definition bslstl_unorderedmultiset.h:2703
iterator insert(const value_type &value)
Definition bslstl_unorderedmultiset.h:2753
AllocatorTraits::size_type size_type
Definition bslstl_unorderedmultiset.h:856
iterator emplace_hint(const_iterator hint, Args &&... args)
Definition bslstl_unorderedmultiset.h:2618
AllocatorTraits::pointer pointer
Definition bslstl_unorderedmultiset.h:858
void rehash(size_type numBuckets)
Definition bslstl_unorderedmultiset.h:2818
iterator emplace(Args &&... args)
Definition bslstl_unorderedmultiset.h:2607
unordered_multiset & operator=(const unordered_multiset &rhs)
Definition bslstl_unorderedmultiset.h:2556
bool contains(const key_type &key) const
Definition bslstl_unorderedmultiset.h:2994
float load_factor() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:3069
value_type & reference
Definition bslstl_unorderedmultiset.h:853
float max_load_factor() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:3077
HASH hasher
Definition bslstl_unorderedmultiset.h:850
const_iterator cend() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:2884
::BloombergLP::bslstl::HashTableBucketIterator< const value_type, difference_type > local_iterator
Definition bslstl_unorderedmultiset.h:865
size_type size() const BSLS_KEYWORD_NOEXCEPT
Return the number of elements in this unordered multiset.
Definition bslstl_unorderedmultiset.h:3012
EQUAL key_equal
Definition bslstl_unorderedmultiset.h:851
~unordered_multiset()
Destroy this object.
Definition bslstl_unorderedmultiset.h:2547
ALLOCATOR allocator_type
Definition bslstl_unorderedmultiset.h:852
ALLOCATOR get_allocator() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:2848
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_unorderedmultiset.h:1727
KEY key_type
Definition bslstl_unorderedmultiset.h:848
unordered_multiset()
Definition bslstl_unorderedmultiset.h:2336
const_iterator cbegin() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_unorderedmultiset.h:2875
#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_CONSTEXPR_CPP17
Definition bsls_keyword.h:639
#define BSLS_KEYWORD_NOEXCEPT_OPERATOR(...)
Definition bsls_keyword.h:677
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:674
#define BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(...)
Definition bsls_keyword.h:676
#define BSLSTL_UNORDEREDMULTISET_REQUIRES_CONTAINER_COMPATIBLE_RANGE(R, T)
Definition bslstl_unorderedmultiset.h:764
void swap(OptionValue &a, OptionValue &b)
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)
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