BDE 4.39.x 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 Thu Mar 5 22:51:43 2026
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 /// Create an empty `FlatHashSet` object. Optionally specify a
363 /// `capacity` indicating the minimum initial size of the underlying
364 /// array of entries of this container. If `capacity` is not supplied
365 /// or is 0, no memory is allocated. Optionally specify a `hash`
366 /// functor used to generate the hash values associated with the
367 /// elements in this container. If `hash` is not supplied, a
368 /// default-constructed object of the (template parameter) type `HASH`
369 /// is used. Optionally specify an equality functor `equal` used to
370 /// determine whether two elements are equivalent. If `equal` is not
371 /// supplied, a default-constructed object of the (template parameter)
372 /// type `EQUAL` is used. Optionally specify a `basicAllocator` used to
373 /// supply memory. If `basicAllocator` is not supplied or is 0, the
374 /// currently installed default allocator is used.
375 FlatHashSet();
376 explicit FlatHashSet(bslma::Allocator *basicAllocator);
377 explicit FlatHashSet(bsl::size_t capacity);
378 FlatHashSet(bsl::size_t capacity, bslma::Allocator *basicAllocator);
379 FlatHashSet(bsl::size_t capacity,
380 const HASH& hash,
381 bslma::Allocator *basicAllocator = 0);
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 default allocator is used.
401 ///
402 /// \pre The behavior is undefined unless `first`
403 /// and `last` refer to a sequence of valid values where `first` is at a position at or before `last`.
404 ///
405 /// \note Note that if a member of the input
406 /// sequence is equivalent to an earlier member, the later member will
407 /// not be inserted.
408 template <class INPUT_ITERATOR>
409 FlatHashSet(INPUT_ITERATOR first,
410 INPUT_ITERATOR last,
411 bslma::Allocator *basicAllocator = 0);
412 template <class INPUT_ITERATOR>
413 FlatHashSet(INPUT_ITERATOR first,
414 INPUT_ITERATOR last,
415 bsl::size_t capacity,
416 bslma::Allocator *basicAllocator = 0);
417 template <class INPUT_ITERATOR>
418 FlatHashSet(INPUT_ITERATOR first,
419 INPUT_ITERATOR last,
420 bsl::size_t capacity,
421 const HASH& hash,
422 bslma::Allocator *basicAllocator = 0);
423 template <class INPUT_ITERATOR>
424 FlatHashSet(INPUT_ITERATOR first,
425 INPUT_ITERATOR last,
426 bsl::size_t capacity,
427 const HASH& hash,
428 const EQUAL& equal,
429 bslma::Allocator *basicAllocator = 0);
430
431#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
432 /// Create a `FlatHashSet` object initialized by insertion of the
433 /// specified `values`. Optionally specify a `capacity` indicating the
434 /// minimum initial size of the underlying array of entries of this
435 /// container. If `capacity` is not supplied or is 0, no memory is
436 /// allocated. Optionally specify a `hash` functor used to generate
437 /// hash values associated with the elements in this container. If
438 /// `hash` is not supplied, a default-constructed object of the
439 /// (template parameter) type `HASH` is used. Optionally specify an
440 /// equality functor `equal` used to verify that two elements are
441 /// equivalent. If `equal` is not supplied, a default-constructed
442 /// object of the (template parameter) type `EQUAL` is used. Optionally
443 /// specify a `basicAllocator` used to supply memory. If
444 /// `basicAllocator` is not supplied or is 0, the currently installed default allocator is used.
445 ///
446 /// \note Note that if a member of `values` has a
447 /// key equivalent to an earlier member, the later member will not be
448 /// inserted.
449 FlatHashSet(bsl::initializer_list<KEY> values,
450 bslma::Allocator *basicAllocator = 0);
451 FlatHashSet(bsl::initializer_list<KEY> values,
452 bsl::size_t capacity,
453 bslma::Allocator *basicAllocator = 0);
454 FlatHashSet(bsl::initializer_list<KEY> values,
455 bsl::size_t capacity,
456 const HASH& hash,
457 bslma::Allocator *basicAllocator = 0);
458 FlatHashSet(bsl::initializer_list<KEY> values,
459 bsl::size_t capacity,
460 const HASH& hash,
461 const EQUAL& equal,
462 bslma::Allocator *basicAllocator = 0);
463#endif
464
465 /// Create a `FlatHashSet` object having the same value, hasher, and
466 /// equality comparator as the specified `original` object. Optionally
467 /// specify a `basicAllocator` used to supply memory. If
468 /// `basicAllocator` is not specified or is 0, the currently installed
469 /// default allocator is used.
470 FlatHashSet(const FlatHashSet& original,
471 bslma::Allocator *basicAllocator = 0);
472
473 /// Create a `FlatHashSet` object having the same value, hasher,
474 /// equality comparator, and allocator as the specified `original`
475 /// object. The contents of `original` are moved (in constant time) to
476 /// this object, `original` is left in a (valid) unspecified state, and
477 /// no exceptions will be thrown.
479
480 /// Create a `FlatHashSet` object having the same value, hasher, and
481 /// equality comparator as the specified `original` object, using the
482 /// specified `basicAllocator` to supply memory. If `basicAllocator` is
483 /// 0, the currently installed default allocator is used. The allocator
484 /// of `original` remains unchanged. If `original` and the newly
485 /// created object have the same allocator then the contents of
486 /// `original` are moved (in constant time) to this object, `original`
487 /// is left in a (valid) unspecified state, and no exceptions will be
488 /// thrown; otherwise `original` is unchanged (and an exception may be
489 /// thrown).
491 bslma::Allocator *basicAllocator);
492
493 /// Destroy this object and each of its elements.
494 ~FlatHashSet();
495
496 // MANIPULATORS
497
498 /// Assign to this object the value, hasher, and equality functor of the
499 /// specified `rhs` object, and return a reference providing modifiable
500 /// access to this object.
501 FlatHashSet& operator=(const FlatHashSet& rhs);
502
503 /// Assign to this object the value, hasher, and equality comparator of
504 /// the specified `rhs` object, and return a reference providing
505 /// modifiable access to this object. If this object and `rhs` use the
506 /// same allocator the contents of `rhs` are moved (in constant time) to
507 /// this object. `rhs` is left in a (valid) unspecified state.
509
510#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
511 /// Assign to this object the value resulting from first clearing this
512 /// set and then inserting each object in the specified `values`
513 /// initializer list, ignoring those objects having a value equivalent
514 /// to that which appears earlier in the list; return a reference
515 /// providing modifiable access to this object. This method requires
516 /// that the (template parameter) type `KEY` be `copy-insertable` into
517 /// this set (see {Requirements on `KEY`, `HASH`, and `EQUAL`}).
518 FlatHashSet& operator=(bsl::initializer_list<KEY> values);
519#endif
520
521 /// Remove all elements from this set.
522 /// \note Note that this set will be empty
523 /// after calling this method, but allocated memory may be retained for
524 /// future use. See the `capacity` method.
525 void clear();
526
527#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
528// {{{ BEGIN GENERATED CODE
529// Command line: sim_cpp11_features.pl bdlc_flathashset.h
530#ifndef BDLC_FLATHASHSET_VARIADIC_LIMIT
531#define BDLC_FLATHASHSET_VARIADIC_LIMIT 10
532#endif
533#ifndef BDLC_FLATHASHSET_VARIADIC_LIMIT_B
534#define BDLC_FLATHASHSET_VARIADIC_LIMIT_B BDLC_FLATHASHSET_VARIADIC_LIMIT
535#endif
536#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 0
538 );
539#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 0
540
541#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 1
542 template <class ARGS_01>
544 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01);
545#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 1
546
547#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 2
548 template <class ARGS_01,
549 class ARGS_02>
551 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
552 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02);
553#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 2
554
555#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 3
556 template <class ARGS_01,
557 class ARGS_02,
558 class ARGS_03>
560 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
561 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
562 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03);
563#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 3
564
565#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 4
566 template <class ARGS_01,
567 class ARGS_02,
568 class ARGS_03,
569 class ARGS_04>
571 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
572 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
573 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
574 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04);
575#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 4
576
577#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 5
578 template <class ARGS_01,
579 class ARGS_02,
580 class ARGS_03,
581 class ARGS_04,
582 class ARGS_05>
584 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
585 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
586 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
587 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
588 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05);
589#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 5
590
591#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 6
592 template <class ARGS_01,
593 class ARGS_02,
594 class ARGS_03,
595 class ARGS_04,
596 class ARGS_05,
597 class ARGS_06>
599 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
600 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
601 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
602 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
603 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
604 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06);
605#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 6
606
607#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 7
608 template <class ARGS_01,
609 class ARGS_02,
610 class ARGS_03,
611 class ARGS_04,
612 class ARGS_05,
613 class ARGS_06,
614 class ARGS_07>
616 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
617 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
618 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
619 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
620 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
621 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
622 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07);
623#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 7
624
625#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 8
626 template <class ARGS_01,
627 class ARGS_02,
628 class ARGS_03,
629 class ARGS_04,
630 class ARGS_05,
631 class ARGS_06,
632 class ARGS_07,
633 class ARGS_08>
635 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
636 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
637 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
638 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
639 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
640 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
641 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
642 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08);
643#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 8
644
645#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 9
646 template <class ARGS_01,
647 class ARGS_02,
648 class ARGS_03,
649 class ARGS_04,
650 class ARGS_05,
651 class ARGS_06,
652 class ARGS_07,
653 class ARGS_08,
654 class ARGS_09>
656 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
657 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
658 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
659 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
660 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
661 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
662 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
663 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
664 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09);
665#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 9
666
667#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 10
668 template <class ARGS_01,
669 class ARGS_02,
670 class ARGS_03,
671 class ARGS_04,
672 class ARGS_05,
673 class ARGS_06,
674 class ARGS_07,
675 class ARGS_08,
676 class ARGS_09,
677 class ARGS_10>
679 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
680 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
681 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
682 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
683 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
684 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
685 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
686 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
687 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
688 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10);
689#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 10
690
691
692#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 0
694#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 0
695
696#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 1
697 template <class ARGS_01>
699 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01);
700#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 1
701
702#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 2
703 template <class ARGS_01,
704 class ARGS_02>
706 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
707 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02);
708#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 2
709
710#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 3
711 template <class ARGS_01,
712 class ARGS_02,
713 class ARGS_03>
715 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
716 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
717 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03);
718#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 3
719
720#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 4
721 template <class ARGS_01,
722 class ARGS_02,
723 class ARGS_03,
724 class ARGS_04>
726 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
727 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
728 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
729 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04);
730#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 4
731
732#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 5
733 template <class ARGS_01,
734 class ARGS_02,
735 class ARGS_03,
736 class ARGS_04,
737 class ARGS_05>
739 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
740 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
741 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
742 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
743 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05);
744#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 5
745
746#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 6
747 template <class ARGS_01,
748 class ARGS_02,
749 class ARGS_03,
750 class ARGS_04,
751 class ARGS_05,
752 class ARGS_06>
754 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
755 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
756 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
757 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
758 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
759 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06);
760#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 6
761
762#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 7
763 template <class ARGS_01,
764 class ARGS_02,
765 class ARGS_03,
766 class ARGS_04,
767 class ARGS_05,
768 class ARGS_06,
769 class ARGS_07>
771 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
772 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
773 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
774 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
775 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
776 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
777 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07);
778#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 7
779
780#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 8
781 template <class ARGS_01,
782 class ARGS_02,
783 class ARGS_03,
784 class ARGS_04,
785 class ARGS_05,
786 class ARGS_06,
787 class ARGS_07,
788 class ARGS_08>
790 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
791 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
792 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
793 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
794 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
795 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
796 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
797 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08);
798#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 8
799
800#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 9
801 template <class ARGS_01,
802 class ARGS_02,
803 class ARGS_03,
804 class ARGS_04,
805 class ARGS_05,
806 class ARGS_06,
807 class ARGS_07,
808 class ARGS_08,
809 class ARGS_09>
811 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
812 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
813 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
814 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
815 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
816 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
817 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
818 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
819 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09);
820#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 9
821
822#if BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 10
823 template <class ARGS_01,
824 class ARGS_02,
825 class ARGS_03,
826 class ARGS_04,
827 class ARGS_05,
828 class ARGS_06,
829 class ARGS_07,
830 class ARGS_08,
831 class ARGS_09,
832 class ARGS_10>
834 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
835 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
836 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
837 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
838 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
839 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
840 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
841 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
842 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
843 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10);
844#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_B >= 10
845
846#else
847// The generated code below is a workaround for the absence of perfect
848// forwarding in some compilers.
849 template <class... ARGS>
852
853 template <class... ARGS>
856// }}} END GENERATED CODE
857#endif
858
859 /// Remove from this set the element whose key is equal to the specified
860 /// `key`, if it exists, and return 1; otherwise (there is no element
861 /// having `key` in this set), return 0 with no other effect. This
862 /// method invalidates all iterators and references to the removed
863 /// element.
864 bsl::size_t erase(const KEY& key);
865
866// {{{ BEGIN GENERATED CODE
867// The generated code below is a workaround for the absence of perfect
868// forwarding in some compilers.
869 template <class LOOKUP_KEY>
870 typename bsl::enable_if<
871 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
872 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
873 , bsl::size_t>::type
875 {
876 return d_impl.erase(key);
877 }
878// }}} END GENERATED CODE
879
880 /// Remove from this set the element at the specified `position`, and
881 /// return a `const_iterator` referring to the element immediately
882 /// following the removed element, or to the past-the-end position if
883 /// the removed element was the last element in the sequence of elements
884 /// maintained by this set. This method invalidates all iterators and references to the removed element.
885 ///
886 /// \pre The behavior is undefined unless
887 /// `position` refers to an element in this set.
889
890 /// Remove from this set the elements starting at the specified `first`
891 /// position up to, but not including, the specified `last` position,
892 /// and return `last`. This method invalidates all iterators and
893 /// references to the removed elements.
894 ///
895 /// \pre The behavior is undefined unless `first` and `last` are valid iterators on this set, and the
896 /// `first` position is at or before the `last` position in the
897 /// iteration sequence provided by this container.
899
900 /// Insert the specified `value` into this set if the `value` does not
901 /// already exist in this set; otherwise, this method has no effect.
902 /// Return a `pair` whose `first` member is a `const_iterator` referring
903 /// to the (possibly newly inserted) element in this set whose value is
904 /// equivalent to that of the element to be inserted, and whose `second`
905 /// member is `true` if a new element was inserted, and `false` if an
906 /// equivalent value was already present.
908 {
909 // Note that some compilers require functions declared with 'enable_if'
910 // to be defined inline.
911
912 return d_impl.insert(value);
913 }
914
915 /// Insert the specified `value` into this set if the `value` does not
916 /// already exist in this set; otherwise, this method has no effect.
917 /// Return a `pair` whose `first` member is a `const_iterator` referring
918 /// to the (possibly newly inserted) element in this set whose value is
919 /// equivalent to that of the element to be inserted, and whose `second`
920 /// member is `true` if a new element was inserted, and `false` if an
921 /// equivalent value was already present.
923 {
924 // Note that some compilers require functions declared with 'enable_if'
925 // to be defined inline.
926
927 return d_impl.insert(BSLS_COMPILERFEATURES_FORWARD(KEY, value));
928 }
929
930// {{{ BEGIN GENERATED CODE
931// The generated code below is a workaround for the absence of perfect
932// forwarding in some compilers.
933 template <class LOOKUP_KEY>
934 typename bsl::enable_if<
935 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
936 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
937 , typename bsl::pair<iterator, bool> >::type
939 {
940 return d_impl.insertTransparent(
941 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key));
942 }
943// }}} END GENERATED CODE
944
945 /// Insert the specified `value` into this set if the `value` does not
946 /// already exist in this set; otherwise, this method has no effect.
947 /// Return a `const_iterator` referring to the (possibly newly inserted)
948 /// element in this set whose value is equivalent to that of the
949 /// element to be inserted. The supplied `const_iterator` is ignored.
950 const_iterator insert(const_iterator, const KEY& value)
951 {
952 // Note that some compilers require functions declared with 'enable_if'
953 // to be defined inline.
954
955 return d_impl.insert(value).first;
956 }
957
958
959 /// Insert the specified `value` into this set if the `value` does not
960 /// already exist in this set; otherwise, this method has no effect.
961 /// Return a `const_iterator` referring to the (possibly newly inserted)
962 /// element in this set whose value is equivalent to that of the
963 /// element to be inserted. The supplied `const_iterator` is ignored.
965 {
966 // Note that some compilers require functions declared with 'enable_if'
967 // to be defined inline.
968
969 return d_impl.insert(BSLS_COMPILERFEATURES_FORWARD(KEY,value)).first;
970 }
971
972// {{{ BEGIN GENERATED CODE
973// The generated code below is a workaround for the absence of perfect
974// forwarding in some compilers.
975 template <class LOOKUP_KEY>
976 typename bsl::enable_if<
977 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
978 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
980 const_iterator>::value == false
983 >::value == false
984 , iterator>::type
986 {
987 return insert(BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key)).first;
988 }
989// }}} END GENERATED CODE
990
991 /// Insert into this set the value of each element in the input iterator
992 /// range specified by `first` through `last` (including `first`, excluding `last`).
993 ///
994 /// \pre The behavior is undefined unless `first` and
995 /// `last` refer to a sequence of valid values where `first` is at a position at or before `last`.
996 ///
997 /// \note Note that if a member of the input
998 /// sequence is equivalent to an earlier member, the later member will
999 /// not be inserted.
1000 template <class INPUT_ITERATOR>
1001 void insert(INPUT_ITERATOR first, INPUT_ITERATOR last);
1002
1003#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1004 /// Insert into this set an element having the value of each object in
1005 /// the specified `values` initializer list if an equivalent value is
1006 /// not already contained in this set. This method requires that the
1007 /// (template parameter) type `KEY` be copy-insertable (see
1008 /// {Requirements on `KEY`, `HASH`, and `EQUAL`}).
1009 void insert(bsl::initializer_list<KEY> values);
1010#endif
1011
1012 /// Change the capacity of this set to at least the specified
1013 /// `minimumCapacity`, and redistribute all the contained elements into
1014 /// a new sequence of entries according to their hash values. If
1015 /// `0 == minimumCapacity` and `0 == size()`, the set is returned to the
1016 /// default constructed state. After this call, `load_factor()` will be
1017 /// less than or equal to `max_load_factor()` and all iterators,
1018 /// pointers, and references to elements of this set are invalidated.
1019 void rehash(bsl::size_t minimumCapacity);
1020
1021 /// Change the capacity of this set to at least a capacity that can
1022 /// accommodate the specified `numEntries` (accounting for the load
1023 /// factor invariant), and redistribute all the contained elements into
1024 /// a new sequence of entries according to their hash values. If
1025 /// `0 == numEntries` and `0 == size()`, the set is returned to the
1026 /// default constructed state. After this call, `load_factor()` will be
1027 /// less than or equal to `max_load_factor()` and all iterators,
1028 /// pointers, and references to elements of this set are invalidated.
1029 ///
1030 /// \note Note that this method is effectively equivalent to:
1031 /// @code
1032 /// rehash(bsl::ceil(numEntries / max_load_factor()))
1033 /// @endcode
1034 void reserve(bsl::size_t numEntries);
1035
1036 /// Remove all elements from this set and release all memory from this
1037 /// set, returning the set to the default constructed state.
1038 void reset();
1039
1040 // Aspects
1041
1042 /// Exchange the value of this object as well as its hasher and equality
1043 /// functors with those of the specified `other` object.
1044 ///
1045 /// \pre The behavior is undefined unless this object was created with the same allocator
1046 /// as `other`.
1047 void swap(FlatHashSet& other);
1048
1049 // ACCESSORS
1050
1051 /// Return the number of elements this set could hold if the load factor
1052 /// were 1.
1053 bsl::size_t capacity() const;
1054
1055 /// Return `true` if this set contains an element having the specified
1056 /// `key`, and `false` otherwise.
1057 bool contains(const KEY& key) const;
1058
1059 /// Return `true` if this set contains an element whose key is equivalent
1060 /// to the specified `key`.
1061 template <class LOOKUP_KEY>
1062 typename bsl::enable_if<
1063 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1064 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
1065 , bool>::type
1066 contains(const LOOKUP_KEY& key) const
1067 {
1068 // Note: implemented inline due to Sun CC compilation error.
1069
1070 return find(key) != end();
1071 }
1072
1073 /// Return the number of elements in this set having the specified `key`.
1074 ///
1075 /// \note Note that since a flat hash set maintains unique keys, the
1076 /// returned value will be either 0 or 1.
1077 bsl::size_t count(const KEY& key) const;
1078
1079 /// Return the number of `value_type` objects within this unordered set
1080 /// that are equivalent to the specified `key`.
1081 ///
1082 /// \pre The behavior is undefined unless `key` is equivalent to at most one element in this unordered set.
1083 ///
1084 /// \note Note that since an unordered set maintains unique
1085 /// keys, the returned value will be either 0 or 1.
1086 template <class LOOKUP_KEY>
1087 typename bsl::enable_if<
1088 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1089 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
1090 , bsl::size_t >::type
1091 count(const LOOKUP_KEY& key) const
1092 {
1093 // Note: implemented inline due to Sun CC compilation error.
1094
1095 return find(key) != end() ? 1 : 0;
1096 }
1097
1098 /// Return `true` if this set contains no elements, and `false`
1099 /// otherwise.
1100 bool empty() const;
1101
1102 /// Return a pair of `const_iterator`s defining the sequence of elements
1103 /// in this set having the specified `key`, where the first iterator is
1104 /// positioned at the start of the sequence and the second iterator is
1105 /// positioned one past the end of the sequence. If this set contains
1106 /// no `KEY` elements equivalent to `key`, then the two returned iterators will have the same value.
1107 ///
1108 /// \note Note that since a set maintains
1109 /// unique keys, the range will contain at most one element.
1111 const KEY& key) const;
1112
1113 /// Return a pair of `const_iterator` providing non-modifiable access to
1114 /// the sequence of `value_type` objects in this unordered set that are
1115 /// equivalent to the specified `key`, where the first iterator is
1116 /// positioned at the start of the sequence and the second iterator is
1117 /// positioned one past the end of the sequence. If this unordered set
1118 /// contains no `value_type` objects equivalent to `key`, then the two returned iterators will have the same value.
1119 ///
1120 /// \note Note that since an
1121 /// unordered set maintains unique keys, the range will contain at most one
1122 /// element.
1123 template <class LOOKUP_KEY>
1124 typename bsl::enable_if<
1125 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1126 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
1128 equal_range(const LOOKUP_KEY& key) const
1129 {
1130 // Note: implemented inline due to Sun CC compilation error.
1131
1132 return d_impl.equal_range(key);
1133 }
1134
1135 /// Return a `const_iterator` referring to the element in this set
1136 /// having the specified `key`, or `end()` if no such entry exists in
1137 /// this set.
1138 const_iterator find(const KEY& key) const;
1139
1140 /// Return a `const_iterator` referring to the element in this set
1141 /// having the specified `key`, or `end()` if no such entry exists in
1142 /// this set.
1143 template <class LOOKUP_KEY>
1144 typename bsl::enable_if<
1145 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1146 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
1147 , const_iterator>::type
1148 find(const LOOKUP_KEY& key) const
1149 {
1150 // Note: implemented inline due to Sun CC compilation error.
1151
1152 return iterator(d_impl.find(key));
1153 }
1154
1155
1156 /// Return (a copy of) the unary hash functor used by this set to
1157 /// generate a hash value (of type `bsl::size_t`) for a `KEY` object.
1158 HASH hash_function() const;
1159
1160 /// Return (a copy of) the binary key-equality functor that returns
1161 /// `true` if the value of two `KEY` objects are equivalent, and `false`
1162 /// otherwise.
1163 EQUAL key_eq() const;
1164
1165 /// Return the current ratio between the number of elements in this
1166 /// container and its capacity.
1167 float load_factor() const;
1168
1169 /// Return the maximum load factor allowed for this set.
1170 /// \note Note that if
1171 /// an insert operation would cause the load factor to exceed
1172 /// `max_load_factor()`, that same insert operation will increase the
1173 /// capacity and rehash the entries of the container (see {Load Factor
1174 /// and Resizing}). Also note that the value returned by
1175 /// @ref max_load_factor is implementation defined and cannot be changed by
1176 /// the user.
1177 float max_load_factor() const;
1178
1179 /// Return the number of elements in this set.
1180 bsl::size_t size() const;
1181
1182 // Iterators
1183
1184 /// Return a `const_iterator` to the first element in the sequence of
1185 /// elements maintained by this set, or the `end` iterator if this set
1186 /// is empty.
1187 const_iterator begin() const;
1188
1189 /// Return a `const_iterator` to the first element in the sequence of
1190 /// elements maintained by this set, or the `end` iterator if this set
1191 /// is empty.
1192 const_iterator cbegin() const;
1193
1194 /// Return a `const_iterator` to the past-the-end element in the
1195 /// sequence of `KEY` elements maintained by this set.
1196 const_iterator cend() const;
1197
1198 /// Return a `const_iterator` to the past-the-end element in the
1199 /// sequence of `KEY` elements maintained by this set.
1200 const_iterator end() const;
1201
1202 // Aspects
1203
1204 /// Return the allocator used by this flat hash set to supply memory.
1205 bslma::Allocator *allocator() const;
1206
1207 /// Format this object to the specified output `stream` at the (absolute
1208 /// value of) the optionally specified indentation `level`, and return a
1209 /// reference to the modifiable `stream`. If `level` is specified,
1210 /// optionally specify `spacesPerLevel`, the number of spaces per
1211 /// indentation level for this and all of its nested objects. If
1212 /// `level` is negative, suppress indentation of the first line. If
1213 /// `spacesPerLevel` is negative, format the entire output on one line,
1214 /// suppressing all but the initial indentation (as governed by
1215 /// `level`). If `stream` is not valid on entry, this operation has no
1216 /// effect.
1217 bsl::ostream& print(bsl::ostream& stream,
1218 int level = 0,
1219 int spacesPerLevel = 4) const;
1220};
1221
1222// FREE OPERATORS
1223
1224/// Return `true` if the specified `lhs` and `rhs` objects have the same
1225/// value, and `false` otherwise. Two `FlatHashSet` objects have the same
1226/// value if their sizes are the same and each element contained in one is
1227/// equal to an element of the other. The hash and equality functors are
1228/// not involved in the comparison.
1229template <class KEY, class HASH, class EQUAL>
1230bool operator==(const FlatHashSet<KEY, HASH, EQUAL> &lhs,
1231 const FlatHashSet<KEY, HASH, EQUAL> &rhs);
1232
1233/// Return `true` if the specified `lhs` and `rhs` objects do not have the
1234/// same value, and `false` otherwise. Two `FlatHashSet` objects do not
1235/// have the same value if their sizes are different or one contains an
1236/// element equal to no element of the other. The hash and equality
1237/// functors are not involved in the comparison.
1238template <class KEY, class HASH, class EQUAL>
1239bool operator!=(const FlatHashSet<KEY, HASH, EQUAL> &lhs,
1240 const FlatHashSet<KEY, HASH, EQUAL> &rhs);
1241
1242/// Write the value of the specified `set` to the specified output `stream`
1243/// in a single-line format, and return a reference providing modifiable
1244/// access to `stream`. If `stream` is not valid on entry, this operation has no effect.
1245///
1246/// \note Note that this human-readable format is not fully
1247/// specified and can change without notice.
1248template <class KEY, class HASH, class EQUAL>
1249bsl::ostream& operator<<(bsl::ostream& stream,
1250 const FlatHashSet<KEY, HASH, EQUAL>& set);
1251
1252// FREE FUNCTIONS
1253
1254/// Exchange the value, the hasher, and the key-equality functor of the
1255/// specified `a` and `b` objects. This function provides the no-throw
1256/// exception-safety guarantee if the two objects were created with the same
1257/// allocator and the basic guarantee otherwise.
1258template <class KEY, class HASH, class EQUAL>
1259void swap(FlatHashSet<KEY, HASH, EQUAL>& a, FlatHashSet<KEY, HASH, EQUAL>& b);
1260
1261// ============================================================================
1262// TEMPLATE AND INLINE FUNCTION DEFINITIONS
1263// ============================================================================
1264
1265 // ----------------------------
1266 // struct FlatHashSet_EntryUtil
1267 // ----------------------------
1268
1269// CLASS METHODS
1270#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1271// {{{ BEGIN GENERATED CODE
1272// Command line: sim_cpp11_features.pl bdlc_flathashset.h
1273#ifndef BDLC_FLATHASHSET_VARIADIC_LIMIT
1274#define BDLC_FLATHASHSET_VARIADIC_LIMIT 10
1275#endif
1276#ifndef BDLC_FLATHASHSET_VARIADIC_LIMIT_F
1277#define BDLC_FLATHASHSET_VARIADIC_LIMIT_F BDLC_FLATHASHSET_VARIADIC_LIMIT
1278#endif
1279#if BDLC_FLATHASHSET_VARIADIC_LIMIT_F >= 0
1280template <class ENTRY>
1281inline
1283 ENTRY *entry,
1284 bslma::Allocator *allocator)
1285{
1286 BSLS_ASSERT_SAFE(entry);
1288 entry,
1289 allocator);
1290}
1291#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_F >= 0
1292
1293#if BDLC_FLATHASHSET_VARIADIC_LIMIT_F >= 1
1294template <class ENTRY>
1295template <class ARGS_01>
1296inline
1298 ENTRY *entry,
1299 bslma::Allocator *allocator,
1300 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01)
1301{
1302 BSLS_ASSERT_SAFE(entry);
1304 entry,
1305 allocator,
1306 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01));
1307}
1308#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_F >= 1
1309
1310#if BDLC_FLATHASHSET_VARIADIC_LIMIT_F >= 2
1311template <class ENTRY>
1312template <class ARGS_01,
1313 class ARGS_02>
1314inline
1316 ENTRY *entry,
1317 bslma::Allocator *allocator,
1318 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1319 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02)
1320{
1321 BSLS_ASSERT_SAFE(entry);
1323 entry,
1324 allocator,
1325 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1326 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02));
1327}
1328#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_F >= 2
1329
1330#if BDLC_FLATHASHSET_VARIADIC_LIMIT_F >= 3
1331template <class ENTRY>
1332template <class ARGS_01,
1333 class ARGS_02,
1334 class ARGS_03>
1335inline
1337 ENTRY *entry,
1338 bslma::Allocator *allocator,
1339 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1340 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1341 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03)
1342{
1343 BSLS_ASSERT_SAFE(entry);
1345 entry,
1346 allocator,
1347 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1348 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
1349 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03));
1350}
1351#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_F >= 3
1352
1353#if BDLC_FLATHASHSET_VARIADIC_LIMIT_F >= 4
1354template <class ENTRY>
1355template <class ARGS_01,
1356 class ARGS_02,
1357 class ARGS_03,
1358 class ARGS_04>
1359inline
1361 ENTRY *entry,
1362 bslma::Allocator *allocator,
1363 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1364 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1365 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1366 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04)
1367{
1368 BSLS_ASSERT_SAFE(entry);
1370 entry,
1371 allocator,
1372 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1373 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
1374 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
1375 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04));
1376}
1377#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_F >= 4
1378
1379#if BDLC_FLATHASHSET_VARIADIC_LIMIT_F >= 5
1380template <class ENTRY>
1381template <class ARGS_01,
1382 class ARGS_02,
1383 class ARGS_03,
1384 class ARGS_04,
1385 class ARGS_05>
1386inline
1388 ENTRY *entry,
1389 bslma::Allocator *allocator,
1390 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1391 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1392 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1393 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1394 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05)
1395{
1396 BSLS_ASSERT_SAFE(entry);
1398 entry,
1399 allocator,
1400 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1401 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
1402 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
1403 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
1404 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05));
1405}
1406#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_F >= 5
1407
1408#if BDLC_FLATHASHSET_VARIADIC_LIMIT_F >= 6
1409template <class ENTRY>
1410template <class ARGS_01,
1411 class ARGS_02,
1412 class ARGS_03,
1413 class ARGS_04,
1414 class ARGS_05,
1415 class ARGS_06>
1416inline
1418 ENTRY *entry,
1419 bslma::Allocator *allocator,
1420 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1421 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1422 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1423 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1424 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1425 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06)
1426{
1427 BSLS_ASSERT_SAFE(entry);
1429 entry,
1430 allocator,
1431 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1432 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
1433 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
1434 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
1435 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
1436 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06));
1437}
1438#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_F >= 6
1439
1440#if BDLC_FLATHASHSET_VARIADIC_LIMIT_F >= 7
1441template <class ENTRY>
1442template <class ARGS_01,
1443 class ARGS_02,
1444 class ARGS_03,
1445 class ARGS_04,
1446 class ARGS_05,
1447 class ARGS_06,
1448 class ARGS_07>
1449inline
1451 ENTRY *entry,
1452 bslma::Allocator *allocator,
1453 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1454 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1455 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1456 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1457 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1458 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1459 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07)
1460{
1461 BSLS_ASSERT_SAFE(entry);
1463 entry,
1464 allocator,
1465 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1466 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
1467 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
1468 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
1469 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
1470 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
1471 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07));
1472}
1473#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_F >= 7
1474
1475#if BDLC_FLATHASHSET_VARIADIC_LIMIT_F >= 8
1476template <class ENTRY>
1477template <class ARGS_01,
1478 class ARGS_02,
1479 class ARGS_03,
1480 class ARGS_04,
1481 class ARGS_05,
1482 class ARGS_06,
1483 class ARGS_07,
1484 class ARGS_08>
1485inline
1487 ENTRY *entry,
1488 bslma::Allocator *allocator,
1489 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1490 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1491 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1492 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1493 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1494 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1495 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
1496 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08)
1497{
1498 BSLS_ASSERT_SAFE(entry);
1500 entry,
1501 allocator,
1502 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1503 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
1504 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
1505 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
1506 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
1507 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
1508 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
1509 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08));
1510}
1511#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_F >= 8
1512
1513#if BDLC_FLATHASHSET_VARIADIC_LIMIT_F >= 9
1514template <class ENTRY>
1515template <class ARGS_01,
1516 class ARGS_02,
1517 class ARGS_03,
1518 class ARGS_04,
1519 class ARGS_05,
1520 class ARGS_06,
1521 class ARGS_07,
1522 class ARGS_08,
1523 class ARGS_09>
1524inline
1526 ENTRY *entry,
1527 bslma::Allocator *allocator,
1528 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1529 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1530 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1531 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1532 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1533 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1534 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
1535 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
1536 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09)
1537{
1538 BSLS_ASSERT_SAFE(entry);
1540 entry,
1541 allocator,
1542 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1543 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
1544 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
1545 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
1546 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
1547 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
1548 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
1549 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
1550 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09));
1551}
1552#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_F >= 9
1553
1554#if BDLC_FLATHASHSET_VARIADIC_LIMIT_F >= 10
1555template <class ENTRY>
1556template <class ARGS_01,
1557 class ARGS_02,
1558 class ARGS_03,
1559 class ARGS_04,
1560 class ARGS_05,
1561 class ARGS_06,
1562 class ARGS_07,
1563 class ARGS_08,
1564 class ARGS_09,
1565 class ARGS_10>
1566inline
1568 ENTRY *entry,
1569 bslma::Allocator *allocator,
1570 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1571 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1572 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1573 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1574 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
1575 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
1576 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
1577 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
1578 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
1579 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10)
1580{
1581 BSLS_ASSERT_SAFE(entry);
1583 entry,
1584 allocator,
1585 BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1586 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
1587 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
1588 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
1589 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
1590 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
1591 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
1592 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
1593 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09),
1594 BSLS_COMPILERFEATURES_FORWARD(ARGS_10, args_10));
1595}
1596#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_F >= 10
1597
1598#else
1599// The generated code below is a workaround for the absence of perfect
1600// forwarding in some compilers.
1601template <class ENTRY>
1602template <class... ARGS>
1603inline
1605 ENTRY *entry,
1606 bslma::Allocator *allocator,
1608{
1609 BSLS_ASSERT_SAFE(entry);
1611 entry,
1612 allocator,
1613 BSLS_COMPILERFEATURES_FORWARD(ARGS, args)...);
1614}
1615// }}} END GENERATED CODE
1616#endif
1617
1618template <class ENTRY>
1619template <class KEY>
1620inline
1622 ENTRY *entry,
1623 bslma::Allocator *allocator,
1625{
1626 BSLS_ASSERT_SAFE(entry);
1627
1629 entry,
1630 allocator,
1632}
1633
1634template <class ENTRY>
1635inline
1636const ENTRY& FlatHashSet_EntryUtil<ENTRY>::key(const ENTRY& entry)
1637{
1638 return entry;
1639}
1640
1641 // -----------------
1642 // class FlatHashSet
1643 // -----------------
1644
1645// CREATORS
1646template <class KEY, class HASH, class EQUAL>
1647inline
1649: d_impl(0, HASH(), EQUAL())
1650{
1651}
1652
1653template <class KEY, class HASH, class EQUAL>
1654inline
1655FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(bslma::Allocator *basicAllocator)
1656: d_impl(0, HASH(), EQUAL(), basicAllocator)
1657{
1658}
1659
1660template <class KEY, class HASH, class EQUAL>
1661inline
1662FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(bsl::size_t capacity)
1663: d_impl(capacity, HASH(), EQUAL())
1664{
1665}
1666
1667template <class KEY, class HASH, class EQUAL>
1668inline
1669FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(bsl::size_t capacity,
1670 bslma::Allocator *basicAllocator)
1671: d_impl(capacity, HASH(), EQUAL(), basicAllocator)
1672{
1673}
1674
1675template <class KEY, class HASH, class EQUAL>
1676inline
1677FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(bsl::size_t capacity,
1678 const HASH& hash,
1679 bslma::Allocator *basicAllocator)
1680: d_impl(capacity, hash, EQUAL(), basicAllocator)
1681{
1682}
1683
1684template <class KEY, class HASH, class EQUAL>
1685inline
1686FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(bsl::size_t capacity,
1687 const HASH& hash,
1688 const EQUAL& equal,
1689 bslma::Allocator *basicAllocator)
1690: d_impl(capacity, hash, equal, basicAllocator)
1691{
1692}
1693
1694template <class KEY, class HASH, class EQUAL>
1695template <class INPUT_ITERATOR>
1696inline
1697FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(INPUT_ITERATOR first,
1698 INPUT_ITERATOR last,
1699 bslma::Allocator *basicAllocator)
1700: d_impl(0, HASH(), EQUAL(), basicAllocator)
1701{
1702 insert(first, last);
1703}
1704
1705template <class KEY, class HASH, class EQUAL>
1706template <class INPUT_ITERATOR>
1707inline
1708FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(INPUT_ITERATOR first,
1709 INPUT_ITERATOR last,
1710 bsl::size_t capacity,
1711 bslma::Allocator *basicAllocator)
1712: d_impl(capacity, HASH(), EQUAL(), basicAllocator)
1713{
1714 insert(first, last);
1715}
1716
1717template <class KEY, class HASH, class EQUAL>
1718template <class INPUT_ITERATOR>
1719inline
1720FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(INPUT_ITERATOR first,
1721 INPUT_ITERATOR last,
1722 bsl::size_t capacity,
1723 const HASH& hash,
1724 bslma::Allocator *basicAllocator)
1725: d_impl(capacity, hash, EQUAL(), basicAllocator)
1726{
1727 insert(first, last);
1728}
1729
1730template <class KEY, class HASH, class EQUAL>
1731template <class INPUT_ITERATOR>
1732inline
1733FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(INPUT_ITERATOR first,
1734 INPUT_ITERATOR last,
1735 bsl::size_t capacity,
1736 const HASH& hash,
1737 const EQUAL& equal,
1738 bslma::Allocator *basicAllocator)
1739: d_impl(capacity, hash, equal, basicAllocator)
1740{
1741 insert(first, last);
1742}
1743
1744#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1745template <class KEY, class HASH, class EQUAL>
1746inline
1747FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(
1748 bsl::initializer_list<KEY> values,
1749 bslma::Allocator *basicAllocator)
1750: FlatHashSet(values.begin(),
1751 values.end(),
1752 0,
1753 HASH(),
1754 EQUAL(),
1755 basicAllocator)
1756{
1757}
1758
1759template <class KEY, class HASH, class EQUAL>
1760inline
1761FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(
1762 bsl::initializer_list<KEY> values,
1763 bsl::size_t capacity,
1764 bslma::Allocator *basicAllocator)
1765: FlatHashSet(values.begin(),
1766 values.end(),
1767 capacity,
1768 HASH(),
1769 EQUAL(),
1770 basicAllocator)
1771{
1772}
1773
1774template <class KEY, class HASH, class EQUAL>
1775inline
1776FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(
1777 bsl::initializer_list<KEY> values,
1778 bsl::size_t capacity,
1779 const HASH& hash,
1780 bslma::Allocator *basicAllocator)
1781: FlatHashSet(values.begin(),
1782 values.end(),
1783 capacity,
1784 hash,
1785 EQUAL(),
1786 basicAllocator)
1787{
1788}
1789
1790template <class KEY, class HASH, class EQUAL>
1791inline
1792FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(
1793 bsl::initializer_list<KEY> values,
1794 bsl::size_t capacity,
1795 const HASH& hash,
1796 const EQUAL& equal,
1797 bslma::Allocator *basicAllocator)
1798: FlatHashSet(values.begin(),
1799 values.end(),
1800 capacity,
1801 hash,
1802 equal,
1803 basicAllocator)
1804{
1805}
1806#endif
1807
1808template <class KEY, class HASH, class EQUAL>
1809inline
1810FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(const FlatHashSet& original,
1811 bslma::Allocator *basicAllocator)
1812: d_impl(original.d_impl, basicAllocator)
1813{
1814}
1815
1816template <class KEY, class HASH, class EQUAL>
1817inline
1818FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(
1820: d_impl(bslmf::MovableRefUtil::move(
1821 bslmf::MovableRefUtil::access(original).d_impl))
1822{
1823}
1824
1825template <class KEY, class HASH, class EQUAL>
1826inline
1827FlatHashSet<KEY, HASH, EQUAL>::FlatHashSet(
1829 bslma::Allocator *basicAllocator)
1830: d_impl(bslmf::MovableRefUtil::move(
1831 bslmf::MovableRefUtil::access(original).d_impl),
1832 basicAllocator)
1833{
1834}
1835
1836template <class KEY, class HASH, class EQUAL>
1837inline
1838FlatHashSet<KEY, HASH, EQUAL>::~FlatHashSet()
1839{
1840}
1841
1842// MANIPULATORS
1843template <class KEY, class HASH, class EQUAL>
1844inline
1845FlatHashSet<KEY, HASH, EQUAL>& FlatHashSet<KEY, HASH, EQUAL>::operator=(
1846 const FlatHashSet& rhs)
1847{
1848 d_impl = rhs.d_impl;
1849
1850 return *this;
1851}
1852
1853template <class KEY, class HASH, class EQUAL>
1854inline
1855FlatHashSet<KEY, HASH, EQUAL>& FlatHashSet<KEY, HASH, EQUAL>::operator=(
1857{
1858 FlatHashSet& lvalue = rhs;
1859
1860 d_impl = bslmf::MovableRefUtil::move(lvalue.d_impl);
1861
1862 return *this;
1863}
1864
1865#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
1866template <class KEY, class HASH, class EQUAL>
1867inline
1868FlatHashSet<KEY, HASH, EQUAL>& FlatHashSet<KEY, HASH, EQUAL>::operator=(
1869 bsl::initializer_list<KEY> values)
1870{
1871 FlatHashSet tmp(values.begin(),
1872 values.end(),
1873 0,
1874 d_impl.hash_function(),
1875 d_impl.key_eq(),
1876 d_impl.allocator());
1877
1878 this->swap(tmp);
1879
1880 return *this;
1881}
1882#endif
1883
1884template <class KEY, class HASH, class EQUAL>
1885inline
1886void FlatHashSet<KEY, HASH, EQUAL>::clear()
1887{
1888 d_impl.clear();
1889}
1890
1891#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1892// {{{ BEGIN GENERATED CODE
1893// Command line: sim_cpp11_features.pl bdlc_flathashset.h
1894#ifndef BDLC_FLATHASHSET_VARIADIC_LIMIT
1895#define BDLC_FLATHASHSET_VARIADIC_LIMIT 10
1896#endif
1897#ifndef BDLC_FLATHASHSET_VARIADIC_LIMIT_G
1898#define BDLC_FLATHASHSET_VARIADIC_LIMIT_G BDLC_FLATHASHSET_VARIADIC_LIMIT
1899#endif
1900#if BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 0
1901template <class KEY, class HASH, class EQUAL>
1903FlatHashSet<KEY, HASH, EQUAL>::emplace(
1904 )
1905{
1906 return d_impl.emplace();
1907}
1908#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 0
1909
1910#if BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 1
1911template <class KEY, class HASH, class EQUAL>
1912template <class ARGS_01>
1914FlatHashSet<KEY, HASH, EQUAL>::emplace(
1915 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01)
1916{
1917 return d_impl.emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01));
1918}
1919#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 1
1920
1921#if BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 2
1922template <class KEY, class HASH, class EQUAL>
1923template <class ARGS_01,
1924 class ARGS_02>
1926FlatHashSet<KEY, HASH, EQUAL>::emplace(
1927 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1928 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02)
1929{
1930 return d_impl.emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1931 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02));
1932}
1933#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 2
1934
1935#if BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 3
1936template <class KEY, class HASH, class EQUAL>
1937template <class ARGS_01,
1938 class ARGS_02,
1939 class ARGS_03>
1941FlatHashSet<KEY, HASH, EQUAL>::emplace(
1942 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1943 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1944 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03)
1945{
1946 return d_impl.emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1947 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
1948 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03));
1949}
1950#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 3
1951
1952#if BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 4
1953template <class KEY, class HASH, class EQUAL>
1954template <class ARGS_01,
1955 class ARGS_02,
1956 class ARGS_03,
1957 class ARGS_04>
1959FlatHashSet<KEY, HASH, EQUAL>::emplace(
1960 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1961 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1962 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1963 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04)
1964{
1965 return d_impl.emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1966 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
1967 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
1968 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04));
1969}
1970#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 4
1971
1972#if BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 5
1973template <class KEY, class HASH, class EQUAL>
1974template <class ARGS_01,
1975 class ARGS_02,
1976 class ARGS_03,
1977 class ARGS_04,
1978 class ARGS_05>
1980FlatHashSet<KEY, HASH, EQUAL>::emplace(
1981 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
1982 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
1983 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
1984 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
1985 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05)
1986{
1987 return d_impl.emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
1988 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
1989 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
1990 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
1991 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05));
1992}
1993#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 5
1994
1995#if BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 6
1996template <class KEY, class HASH, class EQUAL>
1997template <class ARGS_01,
1998 class ARGS_02,
1999 class ARGS_03,
2000 class ARGS_04,
2001 class ARGS_05,
2002 class ARGS_06>
2004FlatHashSet<KEY, HASH, EQUAL>::emplace(
2005 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2006 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2007 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2008 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
2009 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
2010 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06)
2011{
2012 return d_impl.emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2013 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2014 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2015 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2016 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
2017 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06));
2018}
2019#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 6
2020
2021#if BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 7
2022template <class KEY, class HASH, class EQUAL>
2023template <class ARGS_01,
2024 class ARGS_02,
2025 class ARGS_03,
2026 class ARGS_04,
2027 class ARGS_05,
2028 class ARGS_06,
2029 class ARGS_07>
2031FlatHashSet<KEY, HASH, EQUAL>::emplace(
2032 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2033 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2034 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2035 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
2036 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
2037 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
2038 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07)
2039{
2040 return d_impl.emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2041 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2042 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2043 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2044 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
2045 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
2046 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07));
2047}
2048#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 7
2049
2050#if BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 8
2051template <class KEY, class HASH, class EQUAL>
2052template <class ARGS_01,
2053 class ARGS_02,
2054 class ARGS_03,
2055 class ARGS_04,
2056 class ARGS_05,
2057 class ARGS_06,
2058 class ARGS_07,
2059 class ARGS_08>
2061FlatHashSet<KEY, HASH, EQUAL>::emplace(
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 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
2066 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
2067 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
2068 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
2069 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08)
2070{
2071 return d_impl.emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2072 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2073 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2074 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2075 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
2076 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
2077 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
2078 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08));
2079}
2080#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 8
2081
2082#if BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 9
2083template <class KEY, class HASH, class EQUAL>
2084template <class ARGS_01,
2085 class ARGS_02,
2086 class ARGS_03,
2087 class ARGS_04,
2088 class ARGS_05,
2089 class ARGS_06,
2090 class ARGS_07,
2091 class ARGS_08,
2092 class ARGS_09>
2094FlatHashSet<KEY, HASH, EQUAL>::emplace(
2095 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2096 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2097 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2098 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
2099 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
2100 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
2101 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
2102 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
2103 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09)
2104{
2105 return d_impl.emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2106 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2107 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2108 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2109 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
2110 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
2111 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
2112 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
2113 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09));
2114}
2115#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 9
2116
2117#if BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 10
2118template <class KEY, class HASH, class EQUAL>
2119template <class ARGS_01,
2120 class ARGS_02,
2121 class ARGS_03,
2122 class ARGS_04,
2123 class ARGS_05,
2124 class ARGS_06,
2125 class ARGS_07,
2126 class ARGS_08,
2127 class ARGS_09,
2128 class ARGS_10>
2130FlatHashSet<KEY, HASH, EQUAL>::emplace(
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 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
2138 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
2139 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
2140 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10)
2141{
2142 return d_impl.emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2143 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2144 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2145 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2146 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
2147 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
2148 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
2149 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
2150 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09),
2151 BSLS_COMPILERFEATURES_FORWARD(ARGS_10, args_10));
2152}
2153#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 10
2154
2155
2156#if BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 0
2157template <class KEY, class HASH, class EQUAL>
2158inline typename FlatHashSet<KEY, HASH, EQUAL>::iterator
2159FlatHashSet<KEY, HASH, EQUAL>::emplace_hint(
2160 typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator)
2161{
2162 return this->emplace().first;
2163}
2164#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 0
2165
2166#if BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 1
2167template <class KEY, class HASH, class EQUAL>
2168template <class ARGS_01>
2169inline typename FlatHashSet<KEY, HASH, EQUAL>::iterator
2170FlatHashSet<KEY, HASH, EQUAL>::emplace_hint(
2171 typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator,
2172 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01)
2173{
2174 return this->emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01)
2175 ).first;
2176}
2177#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 1
2178
2179#if BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 2
2180template <class KEY, class HASH, class EQUAL>
2181template <class ARGS_01,
2182 class ARGS_02>
2183inline typename FlatHashSet<KEY, HASH, EQUAL>::iterator
2184FlatHashSet<KEY, HASH, EQUAL>::emplace_hint(
2185 typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator,
2186 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2187 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02)
2188{
2189 return this->emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2190 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02)
2191 ).first;
2192}
2193#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 2
2194
2195#if BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 3
2196template <class KEY, class HASH, class EQUAL>
2197template <class ARGS_01,
2198 class ARGS_02,
2199 class ARGS_03>
2200inline typename FlatHashSet<KEY, HASH, EQUAL>::iterator
2201FlatHashSet<KEY, HASH, EQUAL>::emplace_hint(
2202 typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator,
2203 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2204 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2205 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03)
2206{
2207 return this->emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2208 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2209 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03)
2210 ).first;
2211}
2212#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 3
2213
2214#if BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 4
2215template <class KEY, class HASH, class EQUAL>
2216template <class ARGS_01,
2217 class ARGS_02,
2218 class ARGS_03,
2219 class ARGS_04>
2220inline typename FlatHashSet<KEY, HASH, EQUAL>::iterator
2221FlatHashSet<KEY, HASH, EQUAL>::emplace_hint(
2222 typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator,
2223 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2224 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2225 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2226 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04)
2227{
2228 return this->emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2229 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2230 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2231 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04)
2232 ).first;
2233}
2234#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 4
2235
2236#if BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 5
2237template <class KEY, class HASH, class EQUAL>
2238template <class ARGS_01,
2239 class ARGS_02,
2240 class ARGS_03,
2241 class ARGS_04,
2242 class ARGS_05>
2243inline typename FlatHashSet<KEY, HASH, EQUAL>::iterator
2244FlatHashSet<KEY, HASH, EQUAL>::emplace_hint(
2245 typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator,
2246 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2247 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2248 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2249 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
2250 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05)
2251{
2252 return this->emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2253 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2254 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2255 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2256 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05)
2257 ).first;
2258}
2259#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 5
2260
2261#if BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 6
2262template <class KEY, class HASH, class EQUAL>
2263template <class ARGS_01,
2264 class ARGS_02,
2265 class ARGS_03,
2266 class ARGS_04,
2267 class ARGS_05,
2268 class ARGS_06>
2269inline typename FlatHashSet<KEY, HASH, EQUAL>::iterator
2270FlatHashSet<KEY, HASH, EQUAL>::emplace_hint(
2271 typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator,
2272 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2273 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2274 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2275 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
2276 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
2277 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06)
2278{
2279 return this->emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2280 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2281 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2282 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2283 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
2284 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06)
2285 ).first;
2286}
2287#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 6
2288
2289#if BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 7
2290template <class KEY, class HASH, class EQUAL>
2291template <class ARGS_01,
2292 class ARGS_02,
2293 class ARGS_03,
2294 class ARGS_04,
2295 class ARGS_05,
2296 class ARGS_06,
2297 class ARGS_07>
2298inline typename FlatHashSet<KEY, HASH, EQUAL>::iterator
2299FlatHashSet<KEY, HASH, EQUAL>::emplace_hint(
2300 typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator,
2301 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2302 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2303 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2304 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
2305 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
2306 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
2307 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07)
2308{
2309 return this->emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2310 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2311 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2312 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2313 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
2314 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
2315 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07)
2316 ).first;
2317}
2318#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 7
2319
2320#if BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 8
2321template <class KEY, class HASH, class EQUAL>
2322template <class ARGS_01,
2323 class ARGS_02,
2324 class ARGS_03,
2325 class ARGS_04,
2326 class ARGS_05,
2327 class ARGS_06,
2328 class ARGS_07,
2329 class ARGS_08>
2330inline typename FlatHashSet<KEY, HASH, EQUAL>::iterator
2331FlatHashSet<KEY, HASH, EQUAL>::emplace_hint(
2332 typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator,
2333 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2334 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2335 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2336 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
2337 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
2338 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
2339 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
2340 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08)
2341{
2342 return this->emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2343 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2344 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2345 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2346 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
2347 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
2348 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
2349 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08)
2350 ).first;
2351}
2352#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 8
2353
2354#if BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 9
2355template <class KEY, class HASH, class EQUAL>
2356template <class ARGS_01,
2357 class ARGS_02,
2358 class ARGS_03,
2359 class ARGS_04,
2360 class ARGS_05,
2361 class ARGS_06,
2362 class ARGS_07,
2363 class ARGS_08,
2364 class ARGS_09>
2365inline typename FlatHashSet<KEY, HASH, EQUAL>::iterator
2366FlatHashSet<KEY, HASH, EQUAL>::emplace_hint(
2367 typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator,
2368 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2369 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2370 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2371 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
2372 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
2373 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
2374 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
2375 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
2376 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09)
2377{
2378 return this->emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2379 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2380 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2381 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2382 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
2383 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
2384 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
2385 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
2386 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09)
2387 ).first;
2388}
2389#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 9
2390
2391#if BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 10
2392template <class KEY, class HASH, class EQUAL>
2393template <class ARGS_01,
2394 class ARGS_02,
2395 class ARGS_03,
2396 class ARGS_04,
2397 class ARGS_05,
2398 class ARGS_06,
2399 class ARGS_07,
2400 class ARGS_08,
2401 class ARGS_09,
2402 class ARGS_10>
2403inline typename FlatHashSet<KEY, HASH, EQUAL>::iterator
2404FlatHashSet<KEY, HASH, EQUAL>::emplace_hint(
2405 typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator,
2406 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_01) args_01,
2407 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_02) args_02,
2408 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_03) args_03,
2409 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_04) args_04,
2410 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_05) args_05,
2411 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_06) args_06,
2412 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_07) args_07,
2413 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_08) args_08,
2414 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_09) args_09,
2415 BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_10) args_10)
2416{
2417 return this->emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS_01, args_01),
2418 BSLS_COMPILERFEATURES_FORWARD(ARGS_02, args_02),
2419 BSLS_COMPILERFEATURES_FORWARD(ARGS_03, args_03),
2420 BSLS_COMPILERFEATURES_FORWARD(ARGS_04, args_04),
2421 BSLS_COMPILERFEATURES_FORWARD(ARGS_05, args_05),
2422 BSLS_COMPILERFEATURES_FORWARD(ARGS_06, args_06),
2423 BSLS_COMPILERFEATURES_FORWARD(ARGS_07, args_07),
2424 BSLS_COMPILERFEATURES_FORWARD(ARGS_08, args_08),
2425 BSLS_COMPILERFEATURES_FORWARD(ARGS_09, args_09),
2426 BSLS_COMPILERFEATURES_FORWARD(ARGS_10, args_10)
2427 ).first;
2428}
2429#endif // BDLC_FLATHASHSET_VARIADIC_LIMIT_G >= 10
2430
2431#else
2432// The generated code below is a workaround for the absence of perfect
2433// forwarding in some compilers.
2434template <class KEY, class HASH, class EQUAL>
2435template <class... ARGS>
2437FlatHashSet<KEY, HASH, EQUAL>::emplace(
2439{
2440 return d_impl.emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS, args)...);
2441}
2442
2443template <class KEY, class HASH, class EQUAL>
2444template <class... ARGS>
2445inline typename FlatHashSet<KEY, HASH, EQUAL>::iterator
2446FlatHashSet<KEY, HASH, EQUAL>::emplace_hint(
2447 typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator,
2449{
2450 return this->emplace(BSLS_COMPILERFEATURES_FORWARD(ARGS, args)...).first;
2451}
2452
2453// }}} END GENERATED CODE
2454#endif
2455
2456
2457template <class KEY, class HASH, class EQUAL>
2458inline
2459bsl::size_t FlatHashSet<KEY, HASH, EQUAL>::erase(const KEY& key)
2460{
2461 return d_impl.erase(key);
2462}
2463
2464template <class KEY, class HASH, class EQUAL>
2465inline
2466typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator
2467 FlatHashSet<KEY, HASH, EQUAL>::erase(const_iterator position)
2468{
2469 BSLS_ASSERT_SAFE(position != end());
2470
2471 return d_impl.erase(position);
2472}
2473
2474template <class KEY, class HASH, class EQUAL>
2475inline
2476typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator
2477FlatHashSet<KEY, HASH, EQUAL>::erase(const_iterator first, const_iterator last)
2478{
2479 return d_impl.erase(first, last);
2480}
2481
2482template <class KEY, class HASH, class EQUAL>
2483template <class INPUT_ITERATOR>
2484inline
2485void FlatHashSet<KEY, HASH, EQUAL>::insert(INPUT_ITERATOR first,
2486 INPUT_ITERATOR last)
2487{
2488 d_impl.insert(first, last);
2489}
2490
2491#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
2492template <class KEY, class HASH, class EQUAL>
2493inline
2494void FlatHashSet<KEY, HASH, EQUAL>::insert(bsl::initializer_list<KEY> values)
2495{
2496 insert(values.begin(), values.end());
2497}
2498#endif
2499
2500template <class KEY, class HASH, class EQUAL>
2501inline
2502void FlatHashSet<KEY, HASH, EQUAL>::rehash(bsl::size_t minimumCapacity)
2503{
2504 d_impl.rehash(minimumCapacity);
2505}
2506
2507template <class KEY, class HASH, class EQUAL>
2508inline
2509void FlatHashSet<KEY, HASH, EQUAL>::reserve(bsl::size_t numEntries)
2510{
2511 d_impl.reserve(numEntries);
2512}
2513
2514template <class KEY, class HASH, class EQUAL>
2515inline
2516void FlatHashSet<KEY, HASH, EQUAL>::reset()
2517{
2518 d_impl.reset();
2519}
2520
2521 // Aspects
2522
2523template <class KEY, class HASH, class EQUAL>
2524inline
2525void FlatHashSet<KEY, HASH, EQUAL>::swap(FlatHashSet& other)
2526{
2527 BSLS_ASSERT_SAFE(allocator() == other.allocator());
2528
2529 d_impl.swap(other.d_impl);
2530}
2531
2532// ACCESSORS
2533template <class KEY, class HASH, class EQUAL>
2534inline
2535bsl::size_t FlatHashSet<KEY, HASH, EQUAL>::capacity() const
2536{
2537 return d_impl.capacity();
2538}
2539
2540template <class KEY, class HASH, class EQUAL>
2541inline
2542bool FlatHashSet<KEY, HASH, EQUAL>::contains(const KEY& key) const
2543{
2544 return d_impl.contains(key);
2545}
2546
2547template <class KEY, class HASH, class EQUAL>
2548inline
2549bsl::size_t FlatHashSet<KEY, HASH, EQUAL>::count(const KEY& key) const
2550{
2551 return d_impl.count(key);
2552}
2553
2554template <class KEY, class HASH, class EQUAL>
2555inline
2556bool FlatHashSet<KEY, HASH, EQUAL>::empty() const
2557{
2558 return d_impl.empty();
2559}
2560
2561template <class KEY, class HASH, class EQUAL>
2562inline
2564 typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator>
2565 FlatHashSet<KEY, HASH, EQUAL>::equal_range(const KEY& key) const
2566{
2567 return d_impl.equal_range(key);
2568}
2569
2570template <class KEY, class HASH, class EQUAL>
2571inline
2572typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator
2573 FlatHashSet<KEY, HASH, EQUAL>::find(const KEY& key) const
2574{
2575 return d_impl.find(key);
2576}
2577
2578template <class KEY, class HASH, class EQUAL>
2579inline
2580HASH FlatHashSet<KEY, HASH, EQUAL>::hash_function() const
2581{
2582 return d_impl.hash_function();
2583}
2584
2585template <class KEY, class HASH, class EQUAL>
2586inline
2587EQUAL FlatHashSet<KEY, HASH, EQUAL>::key_eq() const
2588{
2589 return d_impl.key_eq();
2590}
2591
2592template <class KEY, class HASH, class EQUAL>
2593inline
2594float FlatHashSet<KEY, HASH, EQUAL>::load_factor() const
2595{
2596 return d_impl.load_factor();
2597}
2598
2599template <class KEY, class HASH, class EQUAL>
2600inline
2601float FlatHashSet<KEY, HASH, EQUAL>::max_load_factor() const
2602{
2603 return d_impl.max_load_factor();
2604}
2605
2606template <class KEY, class HASH, class EQUAL>
2607inline
2608bsl::size_t FlatHashSet<KEY, HASH, EQUAL>::size() const
2609{
2610 return d_impl.size();
2611}
2612
2613 // Iterators
2614
2615template <class KEY, class HASH, class EQUAL>
2616inline
2617typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator
2618 FlatHashSet<KEY, HASH, EQUAL>::begin() const
2619{
2620 return d_impl.begin();
2621}
2622
2623template <class KEY, class HASH, class EQUAL>
2624inline
2625typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator
2626 FlatHashSet<KEY, HASH, EQUAL>::cbegin() const
2627{
2628 return d_impl.cbegin();
2629}
2630
2631template <class KEY, class HASH, class EQUAL>
2632inline
2633typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator
2634 FlatHashSet<KEY, HASH, EQUAL>::cend() const
2635{
2636 return d_impl.cend();
2637}
2638
2639template <class KEY, class HASH, class EQUAL>
2640inline
2641typename FlatHashSet<KEY, HASH, EQUAL>::const_iterator
2642 FlatHashSet<KEY, HASH, EQUAL>::end() const
2643{
2644 return d_impl.end();
2645}
2646
2647 // Aspects
2648
2649template <class KEY, class HASH, class EQUAL>
2650inline
2651bslma::Allocator *FlatHashSet<KEY, HASH, EQUAL>::allocator() const
2652{
2653 return d_impl.allocator();
2654}
2655
2656template <class KEY, class HASH, class EQUAL>
2657bsl::ostream& FlatHashSet<KEY, HASH, EQUAL>::print(
2658 bsl::ostream& stream,
2659 int level,
2660 int spacesPerLevel) const
2661{
2662 if (stream.bad()) {
2663 return stream; // RETURN
2664 }
2665
2666 bslim::Printer printer(&stream, level, spacesPerLevel);
2667
2668 printer.start();
2669
2670 const_iterator iter = begin();
2671 while (iter != end()) {
2672 printer.printValue(*iter);
2673 ++iter;
2674 }
2675
2676 printer.end();
2677
2678 return stream;
2679}
2680
2681} // close package namespace
2682
2683// FREE OPERATORS
2684template <class KEY, class HASH, class EQUAL>
2685inline
2686bool bdlc::operator==(const FlatHashSet<KEY, HASH, EQUAL>& lhs,
2687 const FlatHashSet<KEY, HASH, EQUAL>& rhs)
2688{
2689 return lhs.d_impl == rhs.d_impl;
2690}
2691
2692template <class KEY, class HASH, class EQUAL>
2693inline
2694bool bdlc::operator!=(const FlatHashSet<KEY, HASH, EQUAL>& lhs,
2695 const FlatHashSet<KEY, HASH, EQUAL>& rhs)
2696{
2697 return lhs.d_impl != rhs.d_impl;
2698}
2699
2700template <class KEY, class HASH, class EQUAL>
2701inline
2702bsl::ostream& bdlc::operator<<(bsl::ostream& stream,
2703 const FlatHashSet<KEY, HASH, EQUAL>& set)
2704{
2705 return set.print(stream, 0, -1);
2706}
2707
2708// FREE FUNCTIONS
2709template <class KEY, class HASH, class EQUAL>
2710inline
2711void bdlc::swap(FlatHashSet<KEY, HASH, EQUAL>& a,
2712 FlatHashSet<KEY, HASH, EQUAL>& b)
2713{
2714 bslalg::SwapUtil::swap(&a.d_impl, &b.d_impl);
2715}
2716
2717// ============================================================================
2718// TYPE TRAITS
2719// ============================================================================
2720
2721namespace bslalg {
2722
2723template <class KEY, class HASH, class EQUAL>
2724struct HasStlIterators<bdlc::FlatHashSet<KEY, HASH, EQUAL> >
2726{};
2727
2728} // close namespace bslalg
2729
2730namespace bslma {
2731
2732template <class KEY, class HASH, class EQUAL>
2733struct UsesBslmaAllocator<bdlc::FlatHashSet<KEY, HASH, EQUAL> >
2735{};
2736
2737} // close namespace bslma
2738
2739
2740#else // if ! defined(DEFINED_BDLC_FLATHASHSET_H)
2741# error Not valid except when included from bdlc_flathashset.h
2742#endif // ! defined(COMPILING_BDLC_FLATHASHSET_H)
2743
2744#endif // ! defined(INCLUDED_BDLC_FLATHASHSET_CPP03)
2745
2746// ----------------------------------------------------------------------------
2747// Copyright 2020 Bloomberg Finance L.P.
2748//
2749// Licensed under the Apache License, Version 2.0 (the "License");
2750// you may not use this file except in compliance with the License.
2751// You may obtain a copy of the License at
2752//
2753// http://www.apache.org/licenses/LICENSE-2.0
2754//
2755// Unless required by applicable law or agreed to in writing, software
2756// distributed under the License is distributed on an "AS IS" BASIS,
2757// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2758// See the License for the specific language governing permissions and
2759// limitations under the License.
2760// ----------------------------- END-OF-FILE ----------------------------------
2761
2762/** @} */
2763/** @} */
2764/** @} */
iterator emplace_hint(const_iterator hint, ARGS &&... args)
EQUAL key_eq() const
Definition bdlc_flathashset.h:1675
bsl::size_t count(const KEY &key) const
Definition bdlc_flathashset.h:1637
bsl::pair< iterator, bool > emplace(ARGS &&... args)
EQUAL value_compare
Definition bdlc_flathashset.h:601
const_iterator begin() const
Definition bdlc_flathashset.h:1706
HASH hash_function() const
Definition bdlc_flathashset.h:1668
void reserve(bsl::size_t numEntries)
Definition bdlc_flathashset.h:1597
HASH hasher
Definition bdlc_flathashset.h:602
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
Definition bdlc_flathashset.h:1745
const value_type * const_pointer
Definition bdlc_flathashset.h:606
bslma::Allocator * allocator() const
Return the allocator used by this flat hash set to supply memory.
Definition bdlc_flathashset.h:1739
EQUAL key_compare
Definition bdlc_flathashset.h:600
friend void swap(FlatHashSet< K, H, E > &, FlatHashSet< K, H, E > &)
value_type * pointer
Definition bdlc_flathashset.h:605
value_type & reference
Definition bdlc_flathashset.h:603
float load_factor() const
Definition bdlc_flathashset.h:1682
const_iterator find(const KEY &key) const
Definition bdlc_flathashset.h:1661
FlatHashSet()
Definition bdlc_flathashset.h:1280
~FlatHashSet()
Destroy this object and each of its elements.
Definition bdlc_flathashset.h:1470
void clear()
Definition bdlc_flathashset.h:1518
bsl::pair< const_iterator, bool > insert(const KEY &value)
Definition bdlc_flathashset.h:865
const value_type & const_reference
Definition bdlc_flathashset.h:604
void rehash(bsl::size_t minimumCapacity)
Definition bdlc_flathashset.h:1590
ImplType::const_iterator iterator
Definition bdlc_flathashset.h:607
bsl::size_t size() const
Return the number of elements in this set.
Definition bdlc_flathashset.h:1696
const_iterator cbegin() const
Definition bdlc_flathashset.h:1714
KEY value_type
Definition bdlc_flathashset.h:597
const_iterator cend() const
Definition bdlc_flathashset.h:1722
FlatHashSet & operator=(const FlatHashSet &rhs)
Definition bdlc_flathashset.h:1477
bsl::ptrdiff_t difference_type
Definition bdlc_flathashset.h:599
bsl::size_t capacity() const
Definition bdlc_flathashset.h:1623
bsl::size_t erase(const KEY &key)
Definition bdlc_flathashset.h:1547
void reset()
Definition bdlc_flathashset.h:1604
bsl::size_t size_type
Definition bdlc_flathashset.h:598
ImplType::const_iterator const_iterator
Definition bdlc_flathashset.h:608
bool empty() const
Definition bdlc_flathashset.h:1644
float max_load_factor() const
Definition bdlc_flathashset.h:1689
bool contains(const KEY &key) const
Definition bdlc_flathashset.h:1630
bsl::pair< const_iterator, const_iterator > equal_range(const KEY &key) const
Definition bdlc_flathashset.h:1653
const_iterator end() const
Definition bdlc_flathashset.h:1730
KEY key_type
Definition bdlc_flathashset.h:596
bslstl::ForwardIterator< const KEY, IteratorImp > const_iterator
Definition bdlc_flathashtable.h:343
Definition bslstl_pair.h:1280
static void swap(T *a, T *b)
Definition bslalg_swaputil.h:182
Definition bslh_fibonaccibadhashwrapper.h:165
Definition bslim_printer.h:604
Definition bslma_allocator.h:545
Definition bslmf_movableref.h:752
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1917
#define BSLS_COMPILERFEATURES_FORWARD_REF(T)
Definition bsls_compilerfeatures.h:2343
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2349
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:506
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)
ALLOCATOR const STRING_VIEW_LIKE_TYPE & rhs
Definition bslstl_string.h:3918
T::iterator begin(T &container)
Definition bslstl_iterator.h:1593
ALLOCATOR & lhs
Definition bslstl_string.h:3917
T::iterator end(T &container)
Definition bslstl_iterator.h:1621
Definition bdlc_flathashmap.h:2218
Definition baljsn_encoder_testtypes.h:76
Definition bdlbb_blob.h:579
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:1268
static void construct(ENTRY *entry, bslma::Allocator *allocator, ARGS &&... args)
Definition bdlc_flathashset.h:1237
TYPE first
Definition bslstl_pair.h:587
Definition bslmf_enableif.h:530
Definition bslstl_equalto.h:316
Definition bslmf_isconvertible.h:875
static void construct(TARGET_TYPE *address, const ALLOCATOR &allocator)
Definition bslma_constructionutil.h:1244
static MovableRef< t_TYPE > move(t_TYPE &reference) BSLS_KEYWORD_NOEXCEPT
Definition bslmf_movableref.h:1067