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