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