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