BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdlc_flathashset_cpp03.h
Go to the documentation of this file.
1/// @file bdlc_flathashset_cpp03.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bdlc_flathashset_cpp03.h -*-C++-*-
8
9// Automatically generated file. **DO NOT EDIT**
10
11#ifndef INCLUDED_BDLC_FLATHASHSET_CPP03
12#define INCLUDED_BDLC_FLATHASHSET_CPP03
13
14/// @defgroup bdlc_flathashset_cpp03 bdlc_flathashset_cpp03
15/// @brief Provide C++03 implementation for bdlc_flathashset.h
16/// @addtogroup bdl
17/// @{
18/// @addtogroup bdlc
19/// @{
20/// @addtogroup bdlc_flathashset_cpp03
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bdlc_flathashset_cpp03-purpose"> Purpose</a>
25/// * <a href="#bdlc_flathashset_cpp03-classes"> Classes </a>
26/// * <a href="#bdlc_flathashset_cpp03-description"> Description </a>
27///
28/// # Purpose {#bdlc_flathashset_cpp03-purpose}
29/// Provide C++03 implementation for bdlc_flathashset.h
30///
31/// # Classes {#bdlc_flathashset_cpp03-classes}
32/// See bdlc_flathashset.h for list of classes
33///
34/// @see bdlc_flathashset
35///
36/// # Description {#bdlc_flathashset_cpp03-description}
37/// This component is the C++03 translation of a C++11 component,
38/// generated by the 'sim_cpp11_features.pl' program. If the original header
39/// contains any specially delimited regions of C++11 code, then this generated
40/// file contains the C++03 equivalent, i.e., with variadic templates expanded
41/// and rvalue-references replaced by 'bslmf::MovableRef' objects. The header
42/// code in this file is designed to be '#include'd into the original header
43/// when compiling with a C++03 compiler. If there are no specially delimited
44/// regions of C++11 code, then this header contains no code and is not
45/// '#include'd in the original header.
46///
47/// Generated on Sun Sep 1 06:02:14 2024
48/// Command line: sim_cpp11_features.pl bdlc_flathashset.h
49/// @}
50/** @} */
51/** @} */
52
53/** @addtogroup bdl
54 * @{
55 */
56/** @addtogroup bdlc
57 * @{
58 */
59/** @addtogroup bdlc_flathashset_cpp03
60 * @{
61 */
62
63#ifdef COMPILING_BDLC_FLATHASHSET_H
64
65
66namespace bdlc {
67
68// FORWARD DECLARATIONS
69template <class KEY,
71 class EQUAL = bsl::equal_to<KEY> >
72class FlatHashSet;
73
74template <class KEY, class HASH, class EQUAL>
75bool operator==(const FlatHashSet<KEY, HASH, EQUAL> &a,
76 const FlatHashSet<KEY, HASH, EQUAL> &b);
77
78template <class KEY, class HASH, class EQUAL>
79bool operator!=(const FlatHashSet<KEY, HASH, EQUAL> &a,
80 const FlatHashSet<KEY, HASH, EQUAL> &b);
81
82template <class KEY, class HASH, class EQUAL>
83void swap(FlatHashSet<KEY, HASH, EQUAL>& a, FlatHashSet<KEY, HASH, EQUAL>& b);
84
85 // ============================
86 // struct FlatHashSet_EntryUtil
87 // ============================
88
89/// This templated utility provides methods to construct an `ENTRY` and a
90/// method to extract the key from an `ENTRY` (which is, identically, the
91/// `ENTRY`).
92template <class ENTRY>
93struct FlatHashSet_EntryUtil
94{
95 // CLASS METHODS
96#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
97// {{{ BEGIN GENERATED CODE
98// Command line: sim_cpp11_features.pl bdlc_flathashset.h
99#ifndef BDLC_FLATHASHSET_VARIADIC_LIMIT
100#define BDLC_FLATHASHSET_VARIADIC_LIMIT 10
101#endif
102#ifndef BDLC_FLATHASHSET_VARIADIC_LIMIT_A
103#define BDLC_FLATHASHSET_VARIADIC_LIMIT_A BDLC_FLATHASHSET_VARIADIC_LIMIT
104#endif
105#if BDLC_FLATHASHSET_VARIADIC_LIMIT_A >= 0
106 static void construct(
107 ENTRY *entry,
108 bslma::Allocator *allocator);
109#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_A >= 0
110
111#if BDLC_FLATHASHSET_VARIADIC_LIMIT_A >= 1
112 template <class ARGS_01>
113 static void construct(
114 ENTRY *entry,
115 bslma::Allocator *allocator,
116 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01);
117#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_A >= 1
118
119#if BDLC_FLATHASHSET_VARIADIC_LIMIT_A >= 2
120 template <class ARGS_01,
121 class ARGS_02>
122 static void construct(
123 ENTRY *entry,
124 bslma::Allocator *allocator,
125 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
126 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02);
127#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_A >= 2
128
129#if BDLC_FLATHASHSET_VARIADIC_LIMIT_A >= 3
130 template <class ARGS_01,
131 class ARGS_02,
132 class ARGS_03>
133 static void construct(
134 ENTRY *entry,
135 bslma::Allocator *allocator,
136 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
137 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
138 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03);
139#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_A >= 3
140
141#if BDLC_FLATHASHSET_VARIADIC_LIMIT_A >= 4
142 template <class ARGS_01,
143 class ARGS_02,
144 class ARGS_03,
145 class ARGS_04>
146 static void construct(
147 ENTRY *entry,
148 bslma::Allocator *allocator,
149 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
150 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
151 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
152 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04);
153#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_A >= 4
154
155#if BDLC_FLATHASHSET_VARIADIC_LIMIT_A >= 5
156 template <class ARGS_01,
157 class ARGS_02,
158 class ARGS_03,
159 class ARGS_04,
160 class ARGS_05>
161 static void construct(
162 ENTRY *entry,
163 bslma::Allocator *allocator,
164 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
165 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
166 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
167 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
168 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05);
169#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_A >= 5
170
171#if BDLC_FLATHASHSET_VARIADIC_LIMIT_A >= 6
172 template <class ARGS_01,
173 class ARGS_02,
174 class ARGS_03,
175 class ARGS_04,
176 class ARGS_05,
177 class ARGS_06>
178 static void construct(
179 ENTRY *entry,
180 bslma::Allocator *allocator,
181 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
182 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
183 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
184 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
185 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
186 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06);
187#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_A >= 6
188
189#if BDLC_FLATHASHSET_VARIADIC_LIMIT_A >= 7
190 template <class ARGS_01,
191 class ARGS_02,
192 class ARGS_03,
193 class ARGS_04,
194 class ARGS_05,
195 class ARGS_06,
196 class ARGS_07>
197 static void construct(
198 ENTRY *entry,
199 bslma::Allocator *allocator,
200 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
201 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
202 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
203 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
204 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
205 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
206 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07);
207#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_A >= 7
208
209#if BDLC_FLATHASHSET_VARIADIC_LIMIT_A >= 8
210 template <class ARGS_01,
211 class ARGS_02,
212 class ARGS_03,
213 class ARGS_04,
214 class ARGS_05,
215 class ARGS_06,
216 class ARGS_07,
217 class ARGS_08>
218 static void construct(
219 ENTRY *entry,
220 bslma::Allocator *allocator,
221 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
222 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
223 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
224 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
225 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
226 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
227 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
228 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08);
229#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_A >= 8
230
231#if BDLC_FLATHASHSET_VARIADIC_LIMIT_A >= 9
232 template <class ARGS_01,
233 class ARGS_02,
234 class ARGS_03,
235 class ARGS_04,
236 class ARGS_05,
237 class ARGS_06,
238 class ARGS_07,
239 class ARGS_08,
240 class ARGS_09>
241 static void construct(
242 ENTRY *entry,
243 bslma::Allocator *allocator,
244 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
245 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
246 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
247 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
248 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
249 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
250 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
251 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
252 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09);
253#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_A >= 9
254
255#if BDLC_FLATHASHSET_VARIADIC_LIMIT_A >= 10
256 template <class ARGS_01,
257 class ARGS_02,
258 class ARGS_03,
259 class ARGS_04,
260 class ARGS_05,
261 class ARGS_06,
262 class ARGS_07,
263 class ARGS_08,
264 class ARGS_09,
265 class ARGS_10>
266 static void construct(
267 ENTRY *entry,
268 bslma::Allocator *allocator,
269 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
270 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
271 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
272 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
273 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
274 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
275 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
276 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
277 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
278 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10);
279#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_A >= 10
280
281#else
282// The generated code below is a workaround for the absence of perfect
283// forwarding in some compilers.
284 template <class... ARGS>
285 static void construct(
286 ENTRY *entry,
287 bslma::Allocator *allocator,
289// }}} END GENERATED CODE
290#endif
291
292 /// Load into the specified `entry` the `ENTRY` value comprised of the
293 /// specified `key`, using the specified `allocator` to supply memory.
294 /// `allocator` is ignored if the (template parameter) type `ENTRY` is
295 /// not allocator aware.
296 template <class KEY_TYPE>
297 static void constructFromKey(
298 ENTRY *entry,
299 bslma::Allocator *allocator,
301
302 /// Return the specified `entry`.
303 static const ENTRY& key(const ENTRY& entry);
304};
305
306 // =================
307 // class FlatHashSet
308 // =================
309
310/// This class template implements a value-semantic container type holding
311/// an unordered set of unique values of (template parameter) type `KEY`.
312/// The (template parameter) type `HASH` is a functor providing the hash
313/// value for `KEY`. The (template parameter) type `EQUAL` is a functor
314/// providing the equality function for two `KEY` values. See {Requirements
315/// on `KEY`, `HASH`, and `EQUAL`} for more information.
316///
317/// See @ref bdlc_flathashset_cpp03
318template <class KEY, class HASH, class EQUAL>
319class FlatHashSet {
320
321 private:
322 // PRIVATE TYPES
323
324 /// This is the underlying implementation class.
325 typedef FlatHashTable<KEY,
326 KEY,
327 FlatHashSet_EntryUtil<KEY>,
328 HASH,
329 EQUAL> ImplType;
330
331 // FRIENDS
332 friend bool operator==<>(const FlatHashSet&, const FlatHashSet&);
333 friend bool operator!=<>(const FlatHashSet&, const FlatHashSet&);
334
335 // The following verbose declaration is required by the xlC 12.1 compiler.
336 template <class K, class H, class E>
337 friend void swap(FlatHashSet<K, H, E>&, FlatHashSet<K, H, E>&);
338
339 public:
340 // PUBLIC TYPES
341 typedef KEY key_type;
342 typedef KEY value_type;
343 typedef bsl::size_t size_type;
344 typedef bsl::ptrdiff_t difference_type;
345 typedef EQUAL key_compare;
346 typedef EQUAL value_compare;
347 typedef HASH hasher;
348 typedef value_type& reference;
349 typedef const value_type& const_reference;
350 typedef value_type* pointer;
351 typedef const value_type* const_pointer;
352 typedef typename ImplType::const_iterator iterator;
354
355 private:
356 // DATA
357 ImplType d_impl; // underlying flat hash table used by this flat hash set
358
359 public:
360 // CREATORS
361
362 FlatHashSet();
363 explicit FlatHashSet(bslma::Allocator *basicAllocator);
364 explicit FlatHashSet(bsl::size_t capacity);
365 FlatHashSet(bsl::size_t capacity, bslma::Allocator *basicAllocator);
366 FlatHashSet(bsl::size_t capacity,
367 const HASH& hash,
368 bslma::Allocator *basicAllocator = 0);
369 /// Create an empty `FlatHashSet` object. Optionally specify a
370 /// `capacity` indicating the minimum initial size of the underlying
371 /// array of entries of this container. If `capacity` is not supplied
372 /// or is 0, no memory is allocated. Optionally specify a `hash`
373 /// functor used to generate the hash values associated with the
374 /// elements in this container. If `hash` is not supplied, a
375 /// default-constructed object of the (template parameter) type `HASH`
376 /// is used. Optionally specify an equality functor `equal` used to
377 /// determine whether two elements are equivalent. If `equal` is not
378 /// supplied, a default-constructed object of the (template parameter)
379 /// type `EQUAL` is used. Optionally specify a `basicAllocator` used to
380 /// supply memory. If `basicAllocator` is not supplied or is 0, the
381 /// currently installed default allocator is used.
382 FlatHashSet(bsl::size_t capacity,
383 const HASH& hash,
384 const EQUAL& equal,
385 bslma::Allocator *basicAllocator = 0);
386
387 /// Create a `FlatHashSet` object initialized by insertion of the values
388 /// from the input iterator range specified by `first` through `last`
389 /// (including `first`, excluding `last`). Optionally specify a
390 /// `capacity` indicating the minimum initial size of the underlying
391 /// array of entries of this container. If `capacity` is not supplied
392 /// or is 0, no memory is allocated. Optionally specify a `hash`
393 /// functor used to generate hash values associated with the elements in
394 /// this container. If `hash` is not supplied, a default-constructed
395 /// object of the (template parameter) type `HASH` is used. Optionally
396 /// specify an equality functor `equal` used to verify that two elements
397 /// are equivalent. If `equal` is not supplied, a default-constructed
398 /// object of the (template parameter) type `EQUAL` is used. Optionally
399 /// specify a `basicAllocator` used to supply memory. If
400 /// `basicAllocator` is not supplied or is 0, the currently installed
401 /// default allocator is used. The behavior is undefined unless `first`
402 /// and `last` refer to a sequence of valid values where `first` is at a
403 /// position at or before `last`. Note that if a member of the input
404 /// sequence is equivalent to an earlier member, the later member will
405 /// not be inserted.
406 template <class INPUT_ITERATOR>
407 FlatHashSet(INPUT_ITERATOR first,
408 INPUT_ITERATOR last,
409 bslma::Allocator *basicAllocator = 0);
410 template <class INPUT_ITERATOR>
411 FlatHashSet(INPUT_ITERATOR first,
412 INPUT_ITERATOR last,
413 bsl::size_t capacity,
414 bslma::Allocator *basicAllocator = 0);
415 template <class INPUT_ITERATOR>
416 FlatHashSet(INPUT_ITERATOR first,
417 INPUT_ITERATOR last,
418 bsl::size_t capacity,
419 const HASH& hash,
420 bslma::Allocator *basicAllocator = 0);
421 template <class INPUT_ITERATOR>
422 FlatHashSet(INPUT_ITERATOR first,
423 INPUT_ITERATOR last,
424 bsl::size_t capacity,
425 const HASH& hash,
426 const EQUAL& equal,
427 bslma::Allocator *basicAllocator = 0);
428
429#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
430 FlatHashSet(bsl::initializer_list<KEY> values,
431 bslma::Allocator *basicAllocator = 0);
432 FlatHashSet(bsl::initializer_list<KEY> values,
433 bsl::size_t capacity,
434 bslma::Allocator *basicAllocator = 0);
435 FlatHashSet(bsl::initializer_list<KEY> values,
436 bsl::size_t capacity,
437 const HASH& hash,
438 bslma::Allocator *basicAllocator = 0);
439 /// Create a `FlatHashSet` object initialized by insertion of the
440 /// specified `values`. Optionally specify a `capacity` indicating the
441 /// minimum initial size of the underlying array of entries of this
442 /// container. If `capacity` is not supplied or is 0, no memory is
443 /// allocated. Optionally specify a `hash` functor used to generate
444 /// hash values associated with the elements in this container. If
445 /// `hash` is not supplied, a default-constructed object of the
446 /// (template parameter) type `HASH` is used. Optionally specify an
447 /// equality functor `equal` used to verify that two elements are
448 /// equivalent. If `equal` is not supplied, a default-constructed
449 /// object of the (template parameter) type `EQUAL` is used. Optionally
450 /// specify a `basicAllocator` used to supply memory. If
451 /// `basicAllocator` is not supplied or is 0, the currently installed
452 /// default allocator is used. Note that if a member of `values` has a
453 /// key equivalent to an earlier member, the later member will not be
454 /// inserted.
455 FlatHashSet(bsl::initializer_list<KEY> values,
456 bsl::size_t capacity,
457 const HASH& hash,
458 const EQUAL& equal,
459 bslma::Allocator *basicAllocator = 0);
460#endif
461
462 /// Create a `FlatHashSet` object having the same value, hasher, and
463 /// equality comparator as the specified `original` object. Optionally
464 /// specify a `basicAllocator` used to supply memory. If
465 /// `basicAllocator` is not specified or is 0, the currently installed
466 /// default allocator is used.
467 FlatHashSet(const FlatHashSet& original,
468 bslma::Allocator *basicAllocator = 0);
469
470 /// Create a `FlatHashSet` object having the same value, hasher,
471 /// equality comparator, and allocator as the specified `original`
472 /// object. The contents of `original` are moved (in constant time) to
473 /// this object, `original` is left in a (valid) unspecified state, and
474 /// no exceptions will be thrown.
476
477 /// Create a `FlatHashSet` object having the same value, hasher, and
478 /// equality comparator as the specified `original` object, using the
479 /// specified `basicAllocator` to supply memory. If `basicAllocator` is
480 /// 0, the currently installed default allocator is used. The allocator
481 /// of `original` remains unchanged. If `original` and the newly
482 /// created object have the same allocator then the contents of
483 /// `original` are moved (in constant time) to this object, `original`
484 /// is left in a (valid) unspecified state, and no exceptions will be
485 /// thrown; otherwise `original` is unchanged (and an exception may be
486 /// thrown).
488 bslma::Allocator *basicAllocator);
489
490 /// Destroy this object and each of its elements.
491 ~FlatHashSet();
492
493 // MANIPULATORS
494
495 /// Assign to this object the value, hasher, and equality functor of the
496 /// specified `rhs` object, and return a reference providing modifiable
497 /// access to this object.
498 FlatHashSet& operator=(const FlatHashSet& rhs);
499
500 /// Assign to this object the value, hasher, and equality comparator of
501 /// the specified `rhs` object, and return a reference providing
502 /// modifiable access to this object. If this object and `rhs` use the
503 /// same allocator the contents of `rhs` are moved (in constant time) to
504 /// this object. `rhs` is left in a (valid) unspecified state.
506
507#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
508 /// Assign to this object the value resulting from first clearing this
509 /// set and then inserting each object in the specified `values`
510 /// initializer list, ignoring those objects having a value equivalent
511 /// to that which appears earlier in the list; return a reference
512 /// providing modifiable access to this object. This method requires
513 /// that the (template parameter) type `KEY` be `copy-insertable` into
514 /// this set (see {Requirements on `KEY`, `HASH`, and `EQUAL`}).
515 FlatHashSet& operator=(bsl::initializer_list<KEY> values);
516#endif
517
518 /// Remove all elements from this set. Note that this set will be empty
519 /// after calling this method, but allocated memory may be retained for
520 /// future use. See the `capacity` method.
521 void clear();
522
523#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
524// {{{ BEGIN GENERATED CODE
525// Command line: sim_cpp11_features.pl bdlc_flathashset.h
526#ifndef BDLC_FLATHASHSET_VARIADIC_LIMIT
527#define BDLC_FLATHASHSET_VARIADIC_LIMIT 10
528#endif
529#ifndef BDLC_FLATHASHSET_VARIADIC_LIMIT_B
530#define BDLC_FLATHASHSET_VARIADIC_LIMIT_B BDLC_FLATHASHSET_VARIADIC_LIMIT
531#endif
532#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 0
534 );
535#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 0
536
537#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 1
538 template <class ARGS_01>
540 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01);
541#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 1
542
543#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 2
544 template <class ARGS_01,
545 class ARGS_02>
547 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
548 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02);
549#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 2
550
551#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 3
552 template <class ARGS_01,
553 class ARGS_02,
554 class ARGS_03>
556 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
557 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
558 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03);
559#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 3
560
561#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 4
562 template <class ARGS_01,
563 class ARGS_02,
564 class ARGS_03,
565 class ARGS_04>
567 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
568 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
569 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
570 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04);
571#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 4
572
573#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 5
574 template <class ARGS_01,
575 class ARGS_02,
576 class ARGS_03,
577 class ARGS_04,
578 class ARGS_05>
580 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
581 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
582 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
583 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
584 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05);
585#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 5
586
587#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 6
588 template <class ARGS_01,
589 class ARGS_02,
590 class ARGS_03,
591 class ARGS_04,
592 class ARGS_05,
593 class ARGS_06>
595 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
596 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
597 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
598 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
599 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
600 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06);
601#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 6
602
603#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 7
604 template <class ARGS_01,
605 class ARGS_02,
606 class ARGS_03,
607 class ARGS_04,
608 class ARGS_05,
609 class ARGS_06,
610 class ARGS_07>
612 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
613 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
614 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
615 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
616 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
617 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
618 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07);
619#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 7
620
621#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 8
622 template <class ARGS_01,
623 class ARGS_02,
624 class ARGS_03,
625 class ARGS_04,
626 class ARGS_05,
627 class ARGS_06,
628 class ARGS_07,
629 class ARGS_08>
631 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
632 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
633 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
634 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
635 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
636 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
637 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
638 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08);
639#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 8
640
641#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 9
642 template <class ARGS_01,
643 class ARGS_02,
644 class ARGS_03,
645 class ARGS_04,
646 class ARGS_05,
647 class ARGS_06,
648 class ARGS_07,
649 class ARGS_08,
650 class ARGS_09>
652 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
653 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
654 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
655 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
656 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
657 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
658 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
659 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
660 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09);
661#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 9
662
663#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 10
664 template <class ARGS_01,
665 class ARGS_02,
666 class ARGS_03,
667 class ARGS_04,
668 class ARGS_05,
669 class ARGS_06,
670 class ARGS_07,
671 class ARGS_08,
672 class ARGS_09,
673 class ARGS_10>
675 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
676 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
677 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
678 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
679 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
680 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
681 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
682 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
683 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
684 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10);
685#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 10
686
687
688#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 0
690#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 0
691
692#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 1
693 template <class ARGS_01>
695 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01);
696#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 1
697
698#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 2
699 template <class ARGS_01,
700 class ARGS_02>
702 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
703 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02);
704#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 2
705
706#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 3
707 template <class ARGS_01,
708 class ARGS_02,
709 class ARGS_03>
711 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
712 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
713 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03);
714#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 3
715
716#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 4
717 template <class ARGS_01,
718 class ARGS_02,
719 class ARGS_03,
720 class ARGS_04>
722 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
723 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
724 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
725 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04);
726#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 4
727
728#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 5
729 template <class ARGS_01,
730 class ARGS_02,
731 class ARGS_03,
732 class ARGS_04,
733 class ARGS_05>
735 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
736 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
737 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
738 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
739 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05);
740#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 5
741
742#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 6
743 template <class ARGS_01,
744 class ARGS_02,
745 class ARGS_03,
746 class ARGS_04,
747 class ARGS_05,
748 class ARGS_06>
750 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
751 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
752 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
753 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
754 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
755 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06);
756#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 6
757
758#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 7
759 template <class ARGS_01,
760 class ARGS_02,
761 class ARGS_03,
762 class ARGS_04,
763 class ARGS_05,
764 class ARGS_06,
765 class ARGS_07>
767 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
768 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
769 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
770 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
771 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
772 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
773 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07);
774#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 7
775
776#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 8
777 template <class ARGS_01,
778 class ARGS_02,
779 class ARGS_03,
780 class ARGS_04,
781 class ARGS_05,
782 class ARGS_06,
783 class ARGS_07,
784 class ARGS_08>
786 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
787 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
788 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
789 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
790 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
791 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
792 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
793 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08);
794#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 8
795
796#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 9
797 template <class ARGS_01,
798 class ARGS_02,
799 class ARGS_03,
800 class ARGS_04,
801 class ARGS_05,
802 class ARGS_06,
803 class ARGS_07,
804 class ARGS_08,
805 class ARGS_09>
807 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
808 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
809 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
810 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
811 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
812 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
813 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
814 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
815 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09);
816#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 9
817
818#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 10
819 template <class ARGS_01,
820 class ARGS_02,
821 class ARGS_03,
822 class ARGS_04,
823 class ARGS_05,
824 class ARGS_06,
825 class ARGS_07,
826 class ARGS_08,
827 class ARGS_09,
828 class ARGS_10>
830 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
831 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
832 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
833 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
834 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
835 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
836 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
837 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
838 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
839 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10);
840#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 10
841
842#else
843// The generated code below is a workaround for the absence of perfect
844// forwarding in some compilers.
845 template <class... ARGS>
848
849 template <class... ARGS>
852
853// }}} END GENERATED CODE
854#endif
855
856 /// Remove from this set the element whose key is equal to the specified
857 /// `key`, if it exists, and return 1; otherwise (there is no element
858 /// having `key` in this set), return 0 with no other effect. This
859 /// method invalidates all iterators and references to the removed
860 /// element.
861 bsl::size_t erase(const KEY& key);
862
863 /// Remove from this set the element at the specified `position`, and
864 /// return a `const_iterator` referring to the element immediately
865 /// following the removed element, or to the past-the-end position if
866 /// the removed element was the last element in the sequence of elements
867 /// maintained by this set. This method invalidates all iterators and
868 /// references to the removed element. The behavior is undefined unless
869 /// `position` refers to an element in this set.
871
872 /// Remove from this set the elements starting at the specified `first`
873 /// position up to, but not including, the specified `last` position,
874 /// and return `last`. This method invalidates all iterators and
875 /// references to the removed elements. The behavior is undefined
876 /// unless `first` and `last` are valid iterators on this set, and the
877 /// `first` position is at or before the `last` position in the
878 /// iteration sequence provided by this container.
880
881#if defined(BSLS_PLATFORM_CMP_SUN) && BSLS_PLATFORM_CMP_VERSION < 0x5130
882 template <class KEY_TYPE>
884 BSLS_COMPILERFEATURES_FORWARD_REF(KEY_TYPE) value)
885#else
886 /// Insert the specified `value` into this set if the `value` does not
887 /// already exist in this set; otherwise, this method has no effect.
888 /// Return a `pair` whose `first` member is a `const_iterator` referring
889 /// to the (possibly newly inserted) element in this set whose value is
890 /// equivalent to that of the element to be inserted, and whose `second`
891 /// member is `true` if a new element was inserted, and `false` if an
892 /// equivalent value was already present.
893 template <class KEY_TYPE>
897#endif
898 {
899 // Note that some compilers require functions declared with 'enable_if'
900 // to be defined inline.
901
902 return d_impl.insert(BSLS_COMPILERFEATURES_FORWARD(KEY_TYPE, value));
903 }
904
905#if defined(BSLS_PLATFORM_CMP_SUN) && BSLS_PLATFORM_CMP_VERSION < 0x5130
906 template <class KEY_TYPE>
908 BSLS_COMPILERFEATURES_FORWARD_REF(KEY_TYPE) value)
909#else
910 /// Insert the specified `value` into this set if the `value` does not
911 /// already exist in this set; otherwise, this method has no effect.
912 /// Return a `const_iterator` referring to the (possibly newly inserted)
913 /// element in this set whose value is equivalent to that of the
914 /// element to be inserted. The supplied `const_iterator` is ignored.
915 template <class KEY_TYPE>
917 const_iterator>::type
919 BSLS_COMPILERFEATURES_FORWARD_REF(KEY_TYPE) value)
920#endif
921 {
922 // Note that some compilers require functions declared with 'enable_if'
923 // to be defined inline.
924
925 return d_impl.insert(BSLS_COMPILERFEATURES_FORWARD(KEY_TYPE,
926 value)).first;
927 }
928
929 /// Insert into this set the value of each element in the input iterator
930 /// range specified by `first` through `last` (including `first`,
931 /// excluding `last`). The behavior is undefined unless `first` and
932 /// `last` refer to a sequence of valid values where `first` is at a
933 /// position at or before `last`. Note that if a member of the input
934 /// sequence is equivalent to an earlier member, the later member will
935 /// not be inserted.
936 template <class INPUT_ITERATOR>
937 void insert(INPUT_ITERATOR first, INPUT_ITERATOR last);
938
939#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
940 /// Insert into this set an element having the value of each object in
941 /// the specified `values` initializer list if an equivalent value is
942 /// not already contained in this set. This method requires that the
943 /// (template parameter) type `KEY` be copy-insertable (see
944 /// {Requirements on `KEY`, `HASH`, and `EQUAL`}).
945 void insert(bsl::initializer_list<KEY> values);
946#endif
947
948 /// Change the capacity of this set to at least the specified
949 /// `minimumCapacity`, and redistribute all the contained elements into
950 /// a new sequence of entries according to their hash values. If
951 /// `0 == minimumCapacity` and `0 == size()`, the set is returned to the
952 /// default constructed state. After this call, `load_factor()` will be
953 /// less than or equal to `max_load_factor()` and all iterators,
954 /// pointers, and references to elements of this set are invalidated.
955 void rehash(bsl::size_t minimumCapacity);
956
957 /// Change the capacity of this set to at least a capacity that can
958 /// accommodate the specified `numEntries` (accounting for the load
959 /// factor invariant), and redistribute all the contained elements into
960 /// a new sequence of entries according to their hash values. If
961 /// `0 == numEntries` and `0 == size()`, the set is returned to the
962 /// default constructed state. After this call, `load_factor()` will be
963 /// less than or equal to `max_load_factor()` and all iterators,
964 /// pointers, and references to elements of this set are invalidated.
965 /// Note that this method is effectively equivalent to:
966 /// @code
967 /// rehash(bsl::ceil(numEntries / max_load_factor()))
968 /// @endcode
969 void reserve(bsl::size_t numEntries);
970
971 /// Remove all elements from this set and release all memory from this
972 /// set, returning the set to the default constructed state.
973 void reset();
974
975 // Aspects
976
977 /// Exchange the value of this object as well as its hasher and equality
978 /// functors with those of the specified `other` object. The behavior
979 /// is undefined unless this object was created with the same allocator
980 /// as `other`.
981 void swap(FlatHashSet& other);
982
983 // ACCESSORS
984
985 /// Return the number of elements this set could hold if the load factor
986 /// were 1.
987 bsl::size_t capacity() const;
988
989 /// Return `true` if this set contains an element having the specified
990 /// `key`, and `false` otherwise.
991 bool contains(const KEY& key) const;
992
993 /// Return the number of elements in this set having the specified
994 /// `key`. Note that since a flat hash set maintains unique keys, the
995 /// returned value will be either 0 or 1.
996 bsl::size_t count(const KEY& key) const;
997
998 /// Return `true` if this set contains no elements, and `false`
999 /// otherwise.
1000 bool empty() const;
1001
1002 /// Return a pair of `const_iterator`s defining the sequence of elements
1003 /// in this set having the specified `key`, where the first iterator is
1004 /// positioned at the start of the sequence and the second iterator is
1005 /// positioned one past the end of the sequence. If this set contains
1006 /// no `KEY` elements equivalent to `key`, then the two returned
1007 /// iterators will have the same value. Note that since a set maintains
1008 /// unique keys, the range will contain at most one element.
1010 const KEY& key) const;
1011
1012 /// Return a `const_iterator` referring to the element in this set
1013 /// having the specified `key`, or `end()` if no such entry exists in
1014 /// this set.
1015 const_iterator find(const KEY& key) const;
1016
1017 /// Return (a copy of) the unary hash functor used by this set to
1018 /// generate a hash value (of type `bsl::size_t`) for a `KEY` object.
1019 HASH hash_function() const;
1020
1021 /// Return (a copy of) the binary key-equality functor that returns
1022 /// `true` if the value of two `KEY` objects are equivalent, and `false`
1023 /// otherwise.
1024 EQUAL key_eq() const;
1025
1026 /// Return the current ratio between the number of elements in this
1027 /// container and its capacity.
1028 float load_factor() const;
1029
1030 /// Return the maximum load factor allowed for this set. Note that if
1031 /// an insert operation would cause the load factor to exceed
1032 /// `max_load_factor()`, that same insert operation will increase the
1033 /// capacity and rehash the entries of the container (see {Load Factor
1034 /// and Resizing}). Also note that the value returned by
1035 /// `max_load_factor` is implementation defined and cannot be changed by
1036 /// the user.
1037 float max_load_factor() const;
1038
1039 /// Return the number of elements in this set.
1040 bsl::size_t size() const;
1041
1042 // Iterators
1043
1044 /// Return a `const_iterator` to the first element in the sequence of
1045 /// elements maintained by this set, or the `end` iterator if this set
1046 /// is empty.
1047 const_iterator begin() const;
1048
1049 /// Return a `const_iterator` to the first element in the sequence of
1050 /// elements maintained by this set, or the `end` iterator if this set
1051 /// is empty.
1052 const_iterator cbegin() const;
1053
1054 /// Return a `const_iterator` to the past-the-end element in the
1055 /// sequence of `KEY` elements maintained by this set.
1056 const_iterator cend() const;
1057
1058 /// Return a `const_iterator` to the past-the-end element in the
1059 /// sequence of `KEY` elements maintained by this set.
1060 const_iterator end() const;
1061
1062 // Aspects
1063
1064 /// Return the allocator used by this flat hash set to supply memory.
1065 bslma::Allocator *allocator() const;
1066
1067 /// Format this object to the specified output `stream` at the (absolute
1068 /// value of) the optionally specified indentation `level`, and return a
1069 /// reference to the modifiable `stream`. If `level` is specified,
1070 /// optionally specify `spacesPerLevel`, the number of spaces per
1071 /// indentation level for this and all of its nested objects. If
1072 /// `level` is negative, suppress indentation of the first line. If
1073 /// `spacesPerLevel` is negative, format the entire output on one line,
1074 /// suppressing all but the initial indentation (as governed by
1075 /// `level`). If `stream` is not valid on entry, this operation has no
1076 /// effect.
1077 bsl::ostream& print(bsl::ostream& stream,
1078 int level = 0,
1079 int spacesPerLevel = 4) const;
1080};
1081
1082// FREE OPERATORS
1083
1084/// Return `true` if the specified `lhs` and `rhs` objects have the same
1085/// value, and `false` otherwise. Two `FlatHashSet` objects have the same
1086/// value if their sizes are the same and each element contained in one is
1087/// equal to an element of the other. The hash and equality functors are
1088/// not involved in the comparison.
1089template <class KEY, class HASH, class EQUAL>
1090bool operator==(const FlatHashSet<KEY, HASH, EQUAL> &lhs,
1091 const FlatHashSet<KEY, HASH, EQUAL> &rhs);
1092
1093/// Return `true` if the specified `lhs` and `rhs` objects do not have the
1094/// same value, and `false` otherwise. Two `FlatHashSet` objects do not
1095/// have the same value if their sizes are different or one contains an
1096/// element equal to no element of the other. The hash and equality
1097/// functors are not involved in the comparison.
1098template <class KEY, class HASH, class EQUAL>
1099bool operator!=(const FlatHashSet<KEY, HASH, EQUAL> &lhs,
1100 const FlatHashSet<KEY, HASH, EQUAL> &rhs);
1101
1102/// Write the value of the specified `set` to the specified output `stream`
1103/// in a single-line format, and return a reference providing modifiable
1104/// access to `stream`. If `stream` is not valid on entry, this operation
1105/// has no effect. Note that this human-readable format is not fully
1106/// specified and can change without notice.
1107template <class KEY, class HASH, class EQUAL>
1108bsl::ostream& operator<<(bsl::ostream& stream,
1109 const FlatHashSet<KEY, HASH, EQUAL>& set);
1110
1111// FREE FUNCTIONS
1112
1113/// Exchange the value, the hasher, and the key-equality functor of the
1114/// specified `a` and `b` objects. This function provides the no-throw
1115/// exception-safety guarantee if the two objects were created with the same
1116/// allocator and the basic guarantee otherwise.
1117template <class KEY, class HASH, class EQUAL>
1118void swap(FlatHashSet<KEY, HASH, EQUAL>& a, FlatHashSet<KEY, HASH, EQUAL>& b);
1119
1120// ============================================================================
1121// TEMPLATE AND INLINE FUNCTION DEFINITIONS
1122// ============================================================================
1123
1124 // ----------------------------
1125 // struct FlatHashSet_EntryUtil
1126 // ----------------------------
1127
1128// CLASS METHODS
1129#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1130// {{{ BEGIN GENERATED CODE
1131// Command line: sim_cpp11_features.pl bdlc_flathashset.h
1132#ifndef BDLC_FLATHASHSET_VARIADIC_LIMIT
1133#define BDLC_FLATHASHSET_VARIADIC_LIMIT 10
1134#endif
1135#ifndef BDLC_FLATHASHSET_VARIADIC_LIMIT_C
1136#define BDLC_FLATHASHSET_VARIADIC_LIMIT_C BDLC_FLATHASHSET_VARIADIC_LIMIT
1137#endif
1138#if BDLC_FLATHASHSET_VARIADIC_LIMIT_C >= 0
1139template <class ENTRY>
1140inline
1142 ENTRY *entry,
1143 bslma::Allocator *allocator)
1144{
1145 BSLS_ASSERT_SAFE(entry);
1147 entry,
1148 allocator);
1149}
1150#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_C >= 0
1151
1152#if BDLC_FLATHASHSET_VARIADIC_LIMIT_C >= 1
1153template <class ENTRY>
1154template <class ARGS_01>
1155inline
1157 ENTRY *entry,
1158 bslma::Allocator *allocator,
1159 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01)
1160{
1161 BSLS_ASSERT_SAFE(entry);
1163 entry,
1164 allocator,
1165 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01));
1166}
1167#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_C >= 1
1168
1169#if BDLC_FLATHASHSET_VARIADIC_LIMIT_C >= 2
1170template <class ENTRY>
1171template <class ARGS_01,
1172 class ARGS_02>
1173inline
1175 ENTRY *entry,
1176 bslma::Allocator *allocator,
1177 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1178 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02)
1179{
1180 BSLS_ASSERT_SAFE(entry);
1182 entry,
1183 allocator,
1184 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1185 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02));
1186}
1187#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_C >= 2
1188
1189#if BDLC_FLATHASHSET_VARIADIC_LIMIT_C >= 3
1190template <class ENTRY>
1191template <class ARGS_01,
1192 class ARGS_02,
1193 class ARGS_03>
1194inline
1196 ENTRY *entry,
1197 bslma::Allocator *allocator,
1198 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1199 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1200 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03)
1201{
1202 BSLS_ASSERT_SAFE(entry);
1204 entry,
1205 allocator,
1206 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1207 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
1208 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03));
1209}
1210#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_C >= 3
1211
1212#if BDLC_FLATHASHSET_VARIADIC_LIMIT_C >= 4
1213template <class ENTRY>
1214template <class ARGS_01,
1215 class ARGS_02,
1216 class ARGS_03,
1217 class ARGS_04>
1218inline
1220 ENTRY *entry,
1221 bslma::Allocator *allocator,
1222 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1223 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1224 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1225 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04)
1226{
1227 BSLS_ASSERT_SAFE(entry);
1229 entry,
1230 allocator,
1231 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1232 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
1233 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
1234 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04));
1235}
1236#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_C >= 4
1237
1238#if BDLC_FLATHASHSET_VARIADIC_LIMIT_C >= 5
1239template <class ENTRY>
1240template <class ARGS_01,
1241 class ARGS_02,
1242 class ARGS_03,
1243 class ARGS_04,
1244 class ARGS_05>
1245inline
1247 ENTRY *entry,
1248 bslma::Allocator *allocator,
1249 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1250 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1251 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1252 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1253 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05)
1254{
1255 BSLS_ASSERT_SAFE(entry);
1257 entry,
1258 allocator,
1259 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1260 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
1261 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
1262 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
1263 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05));
1264}
1265#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_C >= 5
1266
1267#if BDLC_FLATHASHSET_VARIADIC_LIMIT_C >= 6
1268template <class ENTRY>
1269template <class ARGS_01,
1270 class ARGS_02,
1271 class ARGS_03,
1272 class ARGS_04,
1273 class ARGS_05,
1274 class ARGS_06>
1275inline
1277 ENTRY *entry,
1278 bslma::Allocator *allocator,
1279 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1280 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1281 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1282 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1283 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1284 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06)
1285{
1286 BSLS_ASSERT_SAFE(entry);
1288 entry,
1289 allocator,
1290 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1291 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
1292 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
1293 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
1294 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
1295 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06));
1296}
1297#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_C >= 6
1298
1299#if BDLC_FLATHASHSET_VARIADIC_LIMIT_C >= 7
1300template <class ENTRY>
1301template <class ARGS_01,
1302 class ARGS_02,
1303 class ARGS_03,
1304 class ARGS_04,
1305 class ARGS_05,
1306 class ARGS_06,
1307 class ARGS_07>
1308inline
1310 ENTRY *entry,
1311 bslma::Allocator *allocator,
1312 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1313 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1314 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1315 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1316 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1317 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1318 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07)
1319{
1320 BSLS_ASSERT_SAFE(entry);
1322 entry,
1323 allocator,
1324 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1325 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
1326 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
1327 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
1328 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
1329 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
1330 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07));
1331}
1332#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_C >= 7
1333
1334#if BDLC_FLATHASHSET_VARIADIC_LIMIT_C >= 8
1335template <class ENTRY>
1336template <class ARGS_01,
1337 class ARGS_02,
1338 class ARGS_03,
1339 class ARGS_04,
1340 class ARGS_05,
1341 class ARGS_06,
1342 class ARGS_07,
1343 class ARGS_08>
1344inline
1346 ENTRY *entry,
1347 bslma::Allocator *allocator,
1348 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1349 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1350 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1351 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1352 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1353 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1354 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
1355 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08)
1356{
1357 BSLS_ASSERT_SAFE(entry);
1359 entry,
1360 allocator,
1361 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1362 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
1363 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
1364 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
1365 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
1366 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
1367 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
1368 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08));
1369}
1370#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_C >= 8
1371
1372#if BDLC_FLATHASHSET_VARIADIC_LIMIT_C >= 9
1373template <class ENTRY>
1374template <class ARGS_01,
1375 class ARGS_02,
1376 class ARGS_03,
1377 class ARGS_04,
1378 class ARGS_05,
1379 class ARGS_06,
1380 class ARGS_07,
1381 class ARGS_08,
1382 class ARGS_09>
1383inline
1385 ENTRY *entry,
1386 bslma::Allocator *allocator,
1387 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1388 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1389 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1390 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1391 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1392 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1393 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
1394 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
1395 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09)
1396{
1397 BSLS_ASSERT_SAFE(entry);
1399 entry,
1400 allocator,
1401 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1402 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
1403 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
1404 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
1405 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
1406 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
1407 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
1408 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
1409 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09));
1410}
1411#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_C >= 9
1412
1413#if BDLC_FLATHASHSET_VARIADIC_LIMIT_C >= 10
1414template <class ENTRY>
1415template <class ARGS_01,
1416 class ARGS_02,
1417 class ARGS_03,
1418 class ARGS_04,
1419 class ARGS_05,
1420 class ARGS_06,
1421 class ARGS_07,
1422 class ARGS_08,
1423 class ARGS_09,
1424 class ARGS_10>
1425inline
1427 ENTRY *entry,
1428 bslma::Allocator *allocator,
1429 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1430 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1431 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1432 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1433 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1434 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1435 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
1436 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
1437 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
1438 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10)
1439{
1440 BSLS_ASSERT_SAFE(entry);
1442 entry,
1443 allocator,
1444 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1445 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
1446 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
1447 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
1448 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
1449 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
1450 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
1451 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
1452 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09),
1453 BSLS_COMPILERFEATURES_FORWARD(ARGS_10, args_10));
1454}
1455#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_C >= 10
1456
1457#else
1458// The generated code below is a workaround for the absence of perfect
1459// forwarding in some compilers.
1460template <class ENTRY>
1461template <class... ARGS>
1462inline
1464 ENTRY *entry,
1465 bslma::Allocator *allocator,
1467{
1468 BSLS_ASSERT_SAFE(entry);
1470 entry,
1471 allocator,
1472 BSLS_COMPILERFEATURES_FORWARD(ARGS, args)...);
1473}
1474// }}} END GENERATED CODE
1475#endif
1476
1477template <class ENTRY>
1478template <class KEY>
1479inline
1481 ENTRY *entry,
1482 bslma::Allocator *allocator,
1484{
1485 BSLS_ASSERT_SAFE(entry);
1486
1488 entry,
1489 allocator,
1491}
1492
1493template <class ENTRY>
1494inline
1495const ENTRY& FlatHashSet_EntryUtil<ENTRY>::key(const ENTRY& entry)
1496{
1497 return entry;
1498}
1499
1500 // -----------------
1501 // class FlatHashSet
1502 // -----------------
1503
1504// CREATORS
1505template <class KEY, class HASH, class EQUAL>
1506inline
1508: d_impl(0, HASH(), EQUAL())
1509{
1510}
1511
1512template <class KEY, class HASH, class EQUAL>
1513inline
1514FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(bslma::Allocator *basicAllocator)
1515: d_impl(0, HASH(), EQUAL(), basicAllocator)
1516{
1517}
1518
1519template <class KEY, class HASH, class EQUAL>
1520inline
1521FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(bsl::size_t capacity)
1522: d_impl(capacity, HASH(), EQUAL())
1523{
1524}
1525
1526template <class KEY, class HASH, class EQUAL>
1527inline
1528FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(bsl::size_t capacity,
1529 bslma::Allocator *basicAllocator)
1530: d_impl(capacity, HASH(), EQUAL(), basicAllocator)
1531{
1532}
1533
1534template <class KEY, class HASH, class EQUAL>
1535inline
1536FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(bsl::size_t capacity,
1537 const HASH& hash,
1538 bslma::Allocator *basicAllocator)
1539: d_impl(capacity, hash, EQUAL(), basicAllocator)
1540{
1541}
1542
1543template <class KEY, class HASH, class EQUAL>
1544inline
1545FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(bsl::size_t capacity,
1546 const HASH& hash,
1547 const EQUAL& equal,
1548 bslma::Allocator *basicAllocator)
1549: d_impl(capacity, hash, equal, basicAllocator)
1550{
1551}
1552
1553template <class KEY, class HASH, class EQUAL>
1554template <class INPUT_ITERATOR>
1555inline
1556FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(INPUT_ITERATOR first,
1557 INPUT_ITERATOR last,
1558 bslma::Allocator *basicAllocator)
1559: d_impl(0, HASH(), EQUAL(), basicAllocator)
1560{
1561 insert(first, last);
1562}
1563
1564template <class KEY, class HASH, class EQUAL>
1565template <class INPUT_ITERATOR>
1566inline
1567FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(INPUT_ITERATOR first,
1568 INPUT_ITERATOR last,
1569 bsl::size_t capacity,
1570 bslma::Allocator *basicAllocator)
1571: d_impl(capacity, HASH(), EQUAL(), basicAllocator)
1572{
1573 insert(first, last);
1574}
1575
1576template <class KEY, class HASH, class EQUAL>
1577template <class INPUT_ITERATOR>
1578inline
1579FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(INPUT_ITERATOR first,
1580 INPUT_ITERATOR last,
1581 bsl::size_t capacity,
1582 const HASH& hash,
1583 bslma::Allocator *basicAllocator)
1584: d_impl(capacity, hash, EQUAL(), basicAllocator)
1585{
1586 insert(first, last);
1587}
1588
1589template <class KEY, class HASH, class EQUAL>
1590template <class INPUT_ITERATOR>
1591inline
1592FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(INPUT_ITERATOR first,
1593 INPUT_ITERATOR last,
1594 bsl::size_t capacity,
1595 const HASH& hash,
1596 const EQUAL& equal,
1597 bslma::Allocator *basicAllocator)
1598: d_impl(capacity, hash, equal, basicAllocator)
1599{
1600 insert(first, last);
1601}
1602
1603#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1604template <class KEY, class HASH, class EQUAL>
1605inline
1606FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(
1607 bsl::initializer_list<KEY> values,
1608 bslma::Allocator *basicAllocator)
1609: FlatHashSet(values.begin(),
1610 values.end(),
1611 0,
1612 HASH(),
1613 EQUAL(),
1614 basicAllocator)
1615{
1616}
1617
1618template <class KEY, class HASH, class EQUAL>
1619inline
1620FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(
1621 bsl::initializer_list<KEY> values,
1622 bsl::size_t capacity,
1623 bslma::Allocator *basicAllocator)
1624: FlatHashSet(values.begin(),
1625 values.end(),
1626 capacity,
1627 HASH(),
1628 EQUAL(),
1629 basicAllocator)
1630{
1631}
1632
1633template <class KEY, class HASH, class EQUAL>
1634inline
1635FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(
1636 bsl::initializer_list<KEY> values,
1637 bsl::size_t capacity,
1638 const HASH& hash,
1639 bslma::Allocator *basicAllocator)
1640: FlatHashSet(values.begin(),
1641 values.end(),
1642 capacity,
1643 hash,
1644 EQUAL(),
1645 basicAllocator)
1646{
1647}
1648
1649template <class KEY, class HASH, class EQUAL>
1650inline
1651FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(
1652 bsl::initializer_list<KEY> values,
1653 bsl::size_t capacity,
1654 const HASH& hash,
1655 const EQUAL& equal,
1656 bslma::Allocator *basicAllocator)
1657: FlatHashSet(values.begin(),
1658 values.end(),
1659 capacity,
1660 hash,
1661 equal,
1662 basicAllocator)
1663{
1664}
1665#endif
1666
1667template <class KEY, class HASH, class EQUAL>
1668inline
1669FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(const FlatHashSet& original,
1670 bslma::Allocator *basicAllocator)
1671: d_impl(original.d_impl, basicAllocator)
1672{
1673}
1674
1675template <class KEY, class HASH, class EQUAL>
1676inline
1677FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(
1679: d_impl(bslmf::MovableRefUtil::move(
1680 bslmf::MovableRefUtil::access(original).d_impl))
1681{
1682}
1683
1684template <class KEY, class HASH, class EQUAL>
1685inline
1686FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(
1688 bslma::Allocator *basicAllocator)
1689: d_impl(bslmf::MovableRefUtil::move(
1690 bslmf::MovableRefUtil::access(original).d_impl),
1691 basicAllocator)
1692{
1693}
1694
1695template <class KEY, class HASH, class EQUAL>
1696inline
1697FlatHashSet<KEY, HASH, EQUAL>::~FlatHashSet()
1698{
1699}
1700
1701// MANIPULATORS
1702template <class KEY, class HASH, class EQUAL>
1703inline
1704FlatHashSet<KEY, HASH, EQUAL>& FlatHashSet<KEY, HASH, EQUAL>::operator=(
1705 const FlatHashSet& rhs)
1706{
1707 d_impl = rhs.d_impl;
1708
1709 return *this;
1710}
1711
1712template <class KEY, class HASH, class EQUAL>
1713inline
1714FlatHashSet<KEY, HASH, EQUAL>& FlatHashSet<KEY, HASH, EQUAL>::operator=(
1716{
1717 FlatHashSet& lvalue = rhs;
1718
1719 d_impl = bslmf::MovableRefUtil::move(lvalue.d_impl);
1720
1721 return *this;
1722}
1723
1724#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1725template <class KEY, class HASH, class EQUAL>
1726inline
1727FlatHashSet<KEY, HASH, EQUAL>& FlatHashSet<KEY, HASH, EQUAL>::operator=(
1728 bsl::initializer_list<KEY> values)
1729{
1730 FlatHashSet tmp(values.begin(),
1731 values.end(),
1732 0,
1733 d_impl.hash_function(),
1734 d_impl.key_eq(),
1735 d_impl.allocator());
1736
1737 this->swap(tmp);
1738
1739 return *this;
1740}
1741#endif
1742
1743template <class KEY, class HASH, class EQUAL>
1744inline
1745void FlatHashSet<KEY, HASH, EQUAL>::clear()
1746{
1747 d_impl.clear();
1748}
1749
1750#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1751// {{{ BEGIN GENERATED CODE
1752// Command line: sim_cpp11_features.pl bdlc_flathashset.h
1753#ifndef BDLC_FLATHASHSET_VARIADIC_LIMIT
1754#define BDLC_FLATHASHSET_VARIADIC_LIMIT 10
1755#endif
1756#ifndef BDLC_FLATHASHSET_VARIADIC_LIMIT_D
1757#define BDLC_FLATHASHSET_VARIADIC_LIMIT_D BDLC_FLATHASHSET_VARIADIC_LIMIT
1758#endif
1759#if BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 0
1760template <class KEY, class HASH, class EQUAL>
1762FlatHashSet<KEY, HASH, EQUAL>::emplace(
1763 )
1764{
1765 return d_impl.emplace();
1766}
1767#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 0
1768
1769#if BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 1
1770template <class KEY, class HASH, class EQUAL>
1771template <class ARGS_01>
1773FlatHashSet<KEY, HASH, EQUAL>::emplace(
1774 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01)
1775{
1776 return d_impl.emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01));
1777}
1778#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 1
1779
1780#if BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 2
1781template <class KEY, class HASH, class EQUAL>
1782template <class ARGS_01,
1783 class ARGS_02>
1785FlatHashSet<KEY, HASH, EQUAL>::emplace(
1786 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1787 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02)
1788{
1789 return d_impl.emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1790 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02));
1791}
1792#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 2
1793
1794#if BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 3
1795template <class KEY, class HASH, class EQUAL>
1796template <class ARGS_01,
1797 class ARGS_02,
1798 class ARGS_03>
1800FlatHashSet<KEY, HASH, EQUAL>::emplace(
1801 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1802 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1803 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03)
1804{
1805 return d_impl.emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1806 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
1807 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03));
1808}
1809#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 3
1810
1811#if BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 4
1812template <class KEY, class HASH, class EQUAL>
1813template <class ARGS_01,
1814 class ARGS_02,
1815 class ARGS_03,
1816 class ARGS_04>
1818FlatHashSet<KEY, HASH, EQUAL>::emplace(
1819 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1820 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1821 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1822 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04)
1823{
1824 return d_impl.emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1825 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
1826 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
1827 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04));
1828}
1829#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 4
1830
1831#if BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 5
1832template <class KEY, class HASH, class EQUAL>
1833template <class ARGS_01,
1834 class ARGS_02,
1835 class ARGS_03,
1836 class ARGS_04,
1837 class ARGS_05>
1839FlatHashSet<KEY, HASH, EQUAL>::emplace(
1840 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1841 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1842 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1843 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1844 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05)
1845{
1846 return d_impl.emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1847 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
1848 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
1849 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
1850 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05));
1851}
1852#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 5
1853
1854#if BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 6
1855template <class KEY, class HASH, class EQUAL>
1856template <class ARGS_01,
1857 class ARGS_02,
1858 class ARGS_03,
1859 class ARGS_04,
1860 class ARGS_05,
1861 class ARGS_06>
1863FlatHashSet<KEY, HASH, EQUAL>::emplace(
1864 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1865 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1866 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1867 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1868 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1869 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06)
1870{
1871 return d_impl.emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1872 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
1873 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
1874 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
1875 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
1876 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06));
1877}
1878#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 6
1879
1880#if BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 7
1881template <class KEY, class HASH, class EQUAL>
1882template <class ARGS_01,
1883 class ARGS_02,
1884 class ARGS_03,
1885 class ARGS_04,
1886 class ARGS_05,
1887 class ARGS_06,
1888 class ARGS_07>
1890FlatHashSet<KEY, HASH, EQUAL>::emplace(
1891 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1892 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1893 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1894 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1895 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1896 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1897 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07)
1898{
1899 return d_impl.emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1900 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
1901 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
1902 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
1903 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
1904 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
1905 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07));
1906}
1907#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 7
1908
1909#if BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 8
1910template <class KEY, class HASH, class EQUAL>
1911template <class ARGS_01,
1912 class ARGS_02,
1913 class ARGS_03,
1914 class ARGS_04,
1915 class ARGS_05,
1916 class ARGS_06,
1917 class ARGS_07,
1918 class ARGS_08>
1920FlatHashSet<KEY, HASH, EQUAL>::emplace(
1921 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1922 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1923 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1924 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1925 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1926 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1927 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
1928 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08)
1929{
1930 return d_impl.emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1931 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
1932 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
1933 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
1934 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
1935 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
1936 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
1937 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08));
1938}
1939#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 8
1940
1941#if BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 9
1942template <class KEY, class HASH, class EQUAL>
1943template <class ARGS_01,
1944 class ARGS_02,
1945 class ARGS_03,
1946 class ARGS_04,
1947 class ARGS_05,
1948 class ARGS_06,
1949 class ARGS_07,
1950 class ARGS_08,
1951 class ARGS_09>
1953FlatHashSet<KEY, HASH, EQUAL>::emplace(
1954 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1955 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1956 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1957 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1958 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1959 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1960 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
1961 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
1962 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09)
1963{
1964 return d_impl.emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1965 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
1966 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
1967 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
1968 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
1969 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
1970 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
1971 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
1972 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09));
1973}
1974#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 9
1975
1976#if BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 10
1977template <class KEY, class HASH, class EQUAL>
1978template <class ARGS_01,
1979 class ARGS_02,
1980 class ARGS_03,
1981 class ARGS_04,
1982 class ARGS_05,
1983 class ARGS_06,
1984 class ARGS_07,
1985 class ARGS_08,
1986 class ARGS_09,
1987 class ARGS_10>
1989FlatHashSet<KEY, HASH, EQUAL>::emplace(
1990 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1991 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1992 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1993 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1994 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1995 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1996 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
1997 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
1998 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
1999 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10)
2000{
2001 return d_impl.emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2002 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2003 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2004 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2005 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
2006 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
2007 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
2008 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
2009 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09),
2010 BSLS_COMPILERFEATURES_FORWARD(ARGS_10, args_10));
2011}
2012#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 10
2013
2014
2015#if BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 0
2016template <class KEY, class HASH, class EQUAL>
2017inline typename FlatHashSet<KEY, HASH, EQUAL>::iterator
2018FlatHashSet<KEY, HASH, EQUAL>::emplace_hint(
2019 typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator)
2020{
2021 return this->emplace().first;
2022}
2023#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 0
2024
2025#if BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 1
2026template <class KEY, class HASH, class EQUAL>
2027template <class ARGS_01>
2028inline typename FlatHashSet<KEY, HASH, EQUAL>::iterator
2029FlatHashSet<KEY, HASH, EQUAL>::emplace_hint(
2030 typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator,
2031 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01)
2032{
2033 return this->emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01)
2034 ).first;
2035}
2036#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 1
2037
2038#if BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 2
2039template <class KEY, class HASH, class EQUAL>
2040template <class ARGS_01,
2041 class ARGS_02>
2042inline typename FlatHashSet<KEY, HASH, EQUAL>::iterator
2043FlatHashSet<KEY, HASH, EQUAL>::emplace_hint(
2044 typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator,
2045 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2046 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02)
2047{
2048 return this->emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2049 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02)
2050 ).first;
2051}
2052#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 2
2053
2054#if BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 3
2055template <class KEY, class HASH, class EQUAL>
2056template <class ARGS_01,
2057 class ARGS_02,
2058 class ARGS_03>
2059inline typename FlatHashSet<KEY, HASH, EQUAL>::iterator
2060FlatHashSet<KEY, HASH, EQUAL>::emplace_hint(
2061 typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator,
2062 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2063 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2064 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03)
2065{
2066 return this->emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2067 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2068 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03)
2069 ).first;
2070}
2071#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 3
2072
2073#if BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 4
2074template <class KEY, class HASH, class EQUAL>
2075template <class ARGS_01,
2076 class ARGS_02,
2077 class ARGS_03,
2078 class ARGS_04>
2079inline typename FlatHashSet<KEY, HASH, EQUAL>::iterator
2080FlatHashSet<KEY, HASH, EQUAL>::emplace_hint(
2081 typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator,
2082 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2083 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2084 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2085 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04)
2086{
2087 return this->emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2088 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2089 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2090 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04)
2091 ).first;
2092}
2093#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 4
2094
2095#if BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 5
2096template <class KEY, class HASH, class EQUAL>
2097template <class ARGS_01,
2098 class ARGS_02,
2099 class ARGS_03,
2100 class ARGS_04,
2101 class ARGS_05>
2102inline typename FlatHashSet<KEY, HASH, EQUAL>::iterator
2103FlatHashSet<KEY, HASH, EQUAL>::emplace_hint(
2104 typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator,
2105 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2106 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2107 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2108 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
2109 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05)
2110{
2111 return this->emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2112 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2113 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2114 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2115 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05)
2116 ).first;
2117}
2118#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 5
2119
2120#if BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 6
2121template <class KEY, class HASH, class EQUAL>
2122template <class ARGS_01,
2123 class ARGS_02,
2124 class ARGS_03,
2125 class ARGS_04,
2126 class ARGS_05,
2127 class ARGS_06>
2128inline typename FlatHashSet<KEY, HASH, EQUAL>::iterator
2129FlatHashSet<KEY, HASH, EQUAL>::emplace_hint(
2130 typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator,
2131 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2132 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2133 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2134 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
2135 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
2136 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06)
2137{
2138 return this->emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2139 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2140 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2141 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2142 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
2143 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06)
2144 ).first;
2145}
2146#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 6
2147
2148#if BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 7
2149template <class KEY, class HASH, class EQUAL>
2150template <class ARGS_01,
2151 class ARGS_02,
2152 class ARGS_03,
2153 class ARGS_04,
2154 class ARGS_05,
2155 class ARGS_06,
2156 class ARGS_07>
2157inline typename FlatHashSet<KEY, HASH, EQUAL>::iterator
2158FlatHashSet<KEY, HASH, EQUAL>::emplace_hint(
2159 typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator,
2160 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2161 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2162 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2163 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
2164 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
2165 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
2166 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07)
2167{
2168 return this->emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2169 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2170 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2171 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2172 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
2173 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
2174 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07)
2175 ).first;
2176}
2177#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 7
2178
2179#if BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 8
2180template <class KEY, class HASH, class EQUAL>
2181template <class ARGS_01,
2182 class ARGS_02,
2183 class ARGS_03,
2184 class ARGS_04,
2185 class ARGS_05,
2186 class ARGS_06,
2187 class ARGS_07,
2188 class ARGS_08>
2189inline typename FlatHashSet<KEY, HASH, EQUAL>::iterator
2190FlatHashSet<KEY, HASH, EQUAL>::emplace_hint(
2191 typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator,
2192 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2193 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2194 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2195 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
2196 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
2197 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
2198 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
2199 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08)
2200{
2201 return this->emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2202 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2203 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2204 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2205 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
2206 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
2207 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
2208 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08)
2209 ).first;
2210}
2211#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 8
2212
2213#if BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 9
2214template <class KEY, class HASH, class EQUAL>
2215template <class ARGS_01,
2216 class ARGS_02,
2217 class ARGS_03,
2218 class ARGS_04,
2219 class ARGS_05,
2220 class ARGS_06,
2221 class ARGS_07,
2222 class ARGS_08,
2223 class ARGS_09>
2224inline typename FlatHashSet<KEY, HASH, EQUAL>::iterator
2225FlatHashSet<KEY, HASH, EQUAL>::emplace_hint(
2226 typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator,
2227 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2228 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2229 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2230 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
2231 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
2232 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
2233 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
2234 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
2235 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09)
2236{
2237 return this->emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2238 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2239 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2240 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2241 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
2242 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
2243 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
2244 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
2245 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09)
2246 ).first;
2247}
2248#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 9
2249
2250#if BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 10
2251template <class KEY, class HASH, class EQUAL>
2252template <class ARGS_01,
2253 class ARGS_02,
2254 class ARGS_03,
2255 class ARGS_04,
2256 class ARGS_05,
2257 class ARGS_06,
2258 class ARGS_07,
2259 class ARGS_08,
2260 class ARGS_09,
2261 class ARGS_10>
2262inline typename FlatHashSet<KEY, HASH, EQUAL>::iterator
2263FlatHashSet<KEY, HASH, EQUAL>::emplace_hint(
2264 typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator,
2265 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2266 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2267 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2268 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
2269 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
2270 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
2271 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
2272 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
2273 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
2274 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10)
2275{
2276 return this->emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2277 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2278 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2279 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2280 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
2281 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
2282 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
2283 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
2284 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09),
2285 BSLS_COMPILERFEATURES_FORWARD(ARGS_10, args_10)
2286 ).first;
2287}
2288#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_D >= 10
2289
2290#else
2291// The generated code below is a workaround for the absence of perfect
2292// forwarding in some compilers.
2293template <class KEY, class HASH, class EQUAL>
2294template <class... ARGS>
2296FlatHashSet<KEY, HASH, EQUAL>::emplace(
2298{
2299 return d_impl.emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS, args)...);
2300}
2301
2302template <class KEY, class HASH, class EQUAL>
2303template <class... ARGS>
2304inline typename FlatHashSet<KEY, HASH, EQUAL>::iterator
2305FlatHashSet<KEY, HASH, EQUAL>::emplace_hint(
2306 typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator,
2308{
2309 return this->emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS, args)...).first;
2310}
2311
2312// }}} END GENERATED CODE
2313#endif
2314
2315
2316template <class KEY, class HASH, class EQUAL>
2317inline
2318bsl::size_t FlatHashSet<KEY, HASH, EQUAL>::erase(const KEY& key)
2319{
2320 return d_impl.erase(key);
2321}
2322
2323template <class KEY, class HASH, class EQUAL>
2324inline
2325typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator
2326 FlatHashSet<KEY, HASH, EQUAL>::erase(const_iterator position)
2327{
2328 BSLS_ASSERT_SAFE(position != end());
2329
2330 return d_impl.erase(position);
2331}
2332
2333template <class KEY, class HASH, class EQUAL>
2334inline
2335typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator
2336FlatHashSet<KEY, HASH, EQUAL>::erase(const_iterator first, const_iterator last)
2337{
2338 return d_impl.erase(first, last);
2339}
2340
2341template <class KEY, class HASH, class EQUAL>
2342template <class INPUT_ITERATOR>
2343inline
2344void FlatHashSet<KEY, HASH, EQUAL>::insert(INPUT_ITERATOR first,
2345 INPUT_ITERATOR last)
2346{
2347 d_impl.insert(first, last);
2348}
2349
2350#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2351template <class KEY, class HASH, class EQUAL>
2352inline
2353void FlatHashSet<KEY, HASH, EQUAL>::insert(bsl::initializer_list<KEY> values)
2354{
2355 insert(values.begin(), values.end());
2356}
2357#endif
2358
2359template <class KEY, class HASH, class EQUAL>
2360inline
2361void FlatHashSet<KEY, HASH, EQUAL>::rehash(bsl::size_t minimumCapacity)
2362{
2363 d_impl.rehash(minimumCapacity);
2364}
2365
2366template <class KEY, class HASH, class EQUAL>
2367inline
2368void FlatHashSet<KEY, HASH, EQUAL>::reserve(bsl::size_t numEntries)
2369{
2370 d_impl.reserve(numEntries);
2371}
2372
2373template <class KEY, class HASH, class EQUAL>
2374inline
2375void FlatHashSet<KEY, HASH, EQUAL>::reset()
2376{
2377 d_impl.reset();
2378}
2379
2380 // Aspects
2381
2382template <class KEY, class HASH, class EQUAL>
2383inline
2384void FlatHashSet<KEY, HASH, EQUAL>::swap(FlatHashSet& other)
2385{
2386 BSLS_ASSERT_SAFE(allocator() == other.allocator());
2387
2388 d_impl.swap(other.d_impl);
2389}
2390
2391// ACCESSORS
2392template <class KEY, class HASH, class EQUAL>
2393inline
2394bsl::size_t FlatHashSet<KEY, HASH, EQUAL>::capacity() const
2395{
2396 return d_impl.capacity();
2397}
2398
2399template <class KEY, class HASH, class EQUAL>
2400inline
2401bool FlatHashSet<KEY, HASH, EQUAL>::contains(const KEY& key) const
2402{
2403 return d_impl.contains(key);
2404}
2405
2406template <class KEY, class HASH, class EQUAL>
2407inline
2408bsl::size_t FlatHashSet<KEY, HASH, EQUAL>::count(const KEY& key) const
2409{
2410 return d_impl.count(key);
2411}
2412
2413template <class KEY, class HASH, class EQUAL>
2414inline
2415bool FlatHashSet<KEY, HASH, EQUAL>::empty() const
2416{
2417 return d_impl.empty();
2418}
2419
2420template <class KEY, class HASH, class EQUAL>
2421inline
2423 typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator>
2424 FlatHashSet<KEY, HASH, EQUAL>::equal_range(const KEY& key) const
2425{
2426 return d_impl.equal_range(key);
2427}
2428
2429template <class KEY, class HASH, class EQUAL>
2430inline
2431typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator
2432 FlatHashSet<KEY, HASH, EQUAL>::find(const KEY& key) const
2433{
2434 return d_impl.find(key);
2435}
2436
2437template <class KEY, class HASH, class EQUAL>
2438inline
2439HASH FlatHashSet<KEY, HASH, EQUAL>::hash_function() const
2440{
2441 return d_impl.hash_function();
2442}
2443
2444template <class KEY, class HASH, class EQUAL>
2445inline
2446EQUAL FlatHashSet<KEY, HASH, EQUAL>::key_eq() const
2447{
2448 return d_impl.key_eq();
2449}
2450
2451template <class KEY, class HASH, class EQUAL>
2452inline
2453float FlatHashSet<KEY, HASH, EQUAL>::load_factor() const
2454{
2455 return d_impl.load_factor();
2456}
2457
2458template <class KEY, class HASH, class EQUAL>
2459inline
2460float FlatHashSet<KEY, HASH, EQUAL>::max_load_factor() const
2461{
2462 return d_impl.max_load_factor();
2463}
2464
2465template <class KEY, class HASH, class EQUAL>
2466inline
2467bsl::size_t FlatHashSet<KEY, HASH, EQUAL>::size() const
2468{
2469 return d_impl.size();
2470}
2471
2472 // Iterators
2473
2474template <class KEY, class HASH, class EQUAL>
2475inline
2476typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator
2477 FlatHashSet<KEY, HASH, EQUAL>::begin() const
2478{
2479 return d_impl.begin();
2480}
2481
2482template <class KEY, class HASH, class EQUAL>
2483inline
2484typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator
2485 FlatHashSet<KEY, HASH, EQUAL>::cbegin() const
2486{
2487 return d_impl.cbegin();
2488}
2489
2490template <class KEY, class HASH, class EQUAL>
2491inline
2492typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator
2493 FlatHashSet<KEY, HASH, EQUAL>::cend() const
2494{
2495 return d_impl.cend();
2496}
2497
2498template <class KEY, class HASH, class EQUAL>
2499inline
2500typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator
2501 FlatHashSet<KEY, HASH, EQUAL>::end() const
2502{
2503 return d_impl.end();
2504}
2505
2506 // Aspects
2507
2508template <class KEY, class HASH, class EQUAL>
2509inline
2510bslma::Allocator *FlatHashSet<KEY, HASH, EQUAL>::allocator() const
2511{
2512 return d_impl.allocator();
2513}
2514
2515template <class KEY, class HASH, class EQUAL>
2516bsl::ostream& FlatHashSet<KEY, HASH, EQUAL>::print(
2517 bsl::ostream& stream,
2518 int level,
2519 int spacesPerLevel) const
2520{
2521 if (stream.bad()) {
2522 return stream; // RETURN
2523 }
2524
2525 bslim::Printer printer(&stream, level, spacesPerLevel);
2526
2527 printer.start();
2528
2529 const_iterator iter = begin();
2530 while (iter != end()) {
2531 printer.printValue(*iter);
2532 ++iter;
2533 }
2534
2535 printer.end();
2536
2537 return stream;
2538}
2539
2540} // close package namespace
2541
2542// FREE OPERATORS
2543template <class KEY, class HASH, class EQUAL>
2544inline
2545bool bdlc::operator==(const FlatHashSet<KEY, HASH, EQUAL>& lhs,
2546 const FlatHashSet<KEY, HASH, EQUAL>& rhs)
2547{
2548 return lhs.d_impl == rhs.d_impl;
2549}
2550
2551template <class KEY, class HASH, class EQUAL>
2552inline
2553bool bdlc::operator!=(const FlatHashSet<KEY, HASH, EQUAL>& lhs,
2554 const FlatHashSet<KEY, HASH, EQUAL>& rhs)
2555{
2556 return lhs.d_impl != rhs.d_impl;
2557}
2558
2559template <class KEY, class HASH, class EQUAL>
2560inline
2561bsl::ostream& bdlc::operator<<(bsl::ostream& stream,
2562 const FlatHashSet<KEY, HASH, EQUAL>& set)
2563{
2564 return set.print(stream, 0, -1);
2565}
2566
2567// FREE FUNCTIONS
2568template <class KEY, class HASH, class EQUAL>
2569inline
2570void bdlc::swap(FlatHashSet<KEY, HASH, EQUAL>& a,
2571 FlatHashSet<KEY, HASH, EQUAL>& b)
2572{
2573 bslalg::SwapUtil::swap(&a.d_impl, &b.d_impl);
2574}
2575
2576// ============================================================================
2577// TYPE TRAITS
2578// ============================================================================
2579
2580namespace bslalg {
2581
2582template <class KEY, class HASH, class EQUAL>
2583struct HasStlIterators<bdlc::FlatHashSet<KEY, HASH, EQUAL> >
2585{};
2586
2587} // close namespace bslalg
2588
2589namespace bslma {
2590
2591template <class KEY, class HASH, class EQUAL>
2592struct UsesBslmaAllocator<bdlc::FlatHashSet<KEY, HASH, EQUAL> >
2594{};
2595
2596} // close namespace bslma
2597
2598
2599#else // if ! defined(DEFINED_BDLC_FLATHASHSET_H)
2600# error Not valid except when included from bdlc_flathashset.h
2601#endif // ! defined(COMPILING_BDLC_FLATHASHSET_H)
2602
2603#endif // ! defined(INCLUDED_BDLC_FLATHASHSET_CPP03)
2604
2605// ----------------------------------------------------------------------------
2606// Copyright 2020 Bloomberg Finance L.P.
2607//
2608// Licensed under the Apache License, Version 2.0 (the "License");
2609// you may not use this file except in compliance with the License.
2610// You may obtain a copy of the License at
2611//
2612// http://www.apache.org/licenses/LICENSE-2.0
2613//
2614// Unless required by applicable law or agreed to in writing, software
2615// distributed under the License is distributed on an "AS IS" BASIS,
2616// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2617// See the License for the specific language governing permissions and
2618// limitations under the License.
2619// ----------------------------- END-OF-FILE ----------------------------------
2620
2621/** @} */
2622/** @} */
2623/** @} */
iterator emplace_hint(const_iterator hint, ARGS &&... args)
bsl::enable_if< bsl::is_convertible< KEY_TYPE, KEY >::value, bsl::pair< const_iterator, bool > >::type insert(BSLS_COMPILERFEATURES_FORWARD_REF(KEY_TYPE) value)
Definition bdlc_flathashset.h:840
EQUAL key_eq() const
Definition bdlc_flathashset.h:1515
bsl::size_t count(const KEY &key) const
Definition bdlc_flathashset.h:1477
bsl::pair< iterator, bool > emplace(ARGS &&... args)
EQUAL value_compare
Definition bdlc_flathashset.h:591
const_iterator begin() const
Definition bdlc_flathashset.h:1546
HASH hash_function() const
Definition bdlc_flathashset.h:1508
void reserve(bsl::size_t numEntries)
Definition bdlc_flathashset.h:1437
HASH hasher
Definition bdlc_flathashset.h:592
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
Definition bdlc_flathashset.h:1585
const value_type * const_pointer
Definition bdlc_flathashset.h:596
bslma::Allocator * allocator() const
Return the allocator used by this flat hash set to supply memory.
Definition bdlc_flathashset.h:1579
EQUAL key_compare
Definition bdlc_flathashset.h:590
friend void swap(FlatHashSet< K, H, E > &, FlatHashSet< K, H, E > &)
value_type * pointer
Definition bdlc_flathashset.h:595
value_type & reference
Definition bdlc_flathashset.h:593
float load_factor() const
Definition bdlc_flathashset.h:1522
const_iterator find(const KEY &key) const
Definition bdlc_flathashset.h:1501
FlatHashSet()
Definition bdlc_flathashset.h:1120
~FlatHashSet()
Destroy this object and each of its elements.
Definition bdlc_flathashset.h:1310
void clear()
Definition bdlc_flathashset.h:1358
const value_type & const_reference
Definition bdlc_flathashset.h:594
void rehash(bsl::size_t minimumCapacity)
Definition bdlc_flathashset.h:1430
ImplType::const_iterator iterator
Definition bdlc_flathashset.h:597
bsl::size_t size() const
Return the number of elements in this set.
Definition bdlc_flathashset.h:1536
const_iterator cbegin() const
Definition bdlc_flathashset.h:1554
KEY value_type
Definition bdlc_flathashset.h:587
const_iterator cend() const
Definition bdlc_flathashset.h:1562
FlatHashSet & operator=(const FlatHashSet &rhs)
Definition bdlc_flathashset.h:1317
bsl::ptrdiff_t difference_type
Definition bdlc_flathashset.h:589
bsl::size_t capacity() const
Definition bdlc_flathashset.h:1463
bsl::size_t erase(const KEY &key)
Definition bdlc_flathashset.h:1387
void reset()
Definition bdlc_flathashset.h:1444
bsl::size_t size_type
Definition bdlc_flathashset.h:588
ImplType::const_iterator const_iterator
Definition bdlc_flathashset.h:598
bool empty() const
Definition bdlc_flathashset.h:1484
float max_load_factor() const
Definition bdlc_flathashset.h:1529
bool contains(const KEY &key) const
Definition bdlc_flathashset.h:1470
bsl::pair< const_iterator, const_iterator > equal_range(const KEY &key) const
Definition bdlc_flathashset.h:1493
const_iterator end() const
Definition bdlc_flathashset.h:1570
KEY key_type
Definition bdlc_flathashset.h:586
bslstl::ForwardIterator< const KEY, IteratorImp > const_iterator
Definition bdlc_flathashtable.h:334
Definition bslstl_pair.h:1210
static void swap(T *a, T *b)
Definition bslalg_swaputil.h:194
Definition bslh_fibonaccibadhashwrapper.h:165
Definition bslim_printer.h:601
Definition bslma_allocator.h:457
Definition bslmf_movableref.h:751
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1762
#define BSLS_COMPILERFEATURES_FORWARD_REF(T)
Definition bsls_compilerfeatures.h:2012
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2018
bool operator!=(const FileCleanerConfiguration &lhs, const FileCleanerConfiguration &rhs)
bool operator==(const FileCleanerConfiguration &lhs, const FileCleanerConfiguration &rhs)
void swap(OptionValue &a, OptionValue &b)
Definition bdlc_bitarray.h:503
void swap(BitArray &a, BitArray &b)
bool operator==(const BitArray &lhs, const BitArray &rhs)
bool operator!=(const BitArray &lhs, const BitArray &rhs)
BitArray operator<<(const BitArray &array, bsl::size_t numBits)
T::iterator begin(T &container)
Definition bslstl_iterator.h:1495
T::iterator end(T &container)
Definition bslstl_iterator.h:1523
Definition bdlc_flathashmap.h:1805
Definition balxml_encoderoptions.h:68
Definition bdlbb_blob.h:576
static void constructFromKey(ENTRY *entry, bslma::Allocator *allocator, BSLS_COMPILERFEATURES_FORWARD_REF(KEY_TYPE) key)
static const ENTRY & key(const ENTRY &entry)
Return the specified entry.
Definition bdlc_flathashset.h:1108
static void construct(ENTRY *entry, bslma::Allocator *allocator, ARGS &&... args)
Definition bdlc_flathashset.h:1077
TYPE first
Definition bslstl_pair.h:605
Definition bslmf_enableif.h:525
Definition bslstl_equalto.h:311
static void construct(TARGET_TYPE *address, const ALLOCATOR &allocator)
Definition bslma_constructionutil.h:1243
static MovableRef< t_TYPE > move(t_TYPE &reference) BSLS_KEYWORD_NOEXCEPT
Definition bslmf_movableref.h:1060