BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bslstl_map_cpp03.h
Go to the documentation of this file.
1/// @file bslstl_map_cpp03.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bslstl_map_cpp03.h -*-C++-*-
8
9// Automatically generated file. **DO NOT EDIT**
10
11#ifndef INCLUDED_BSLSTL_MAP_CPP03
12#define INCLUDED_BSLSTL_MAP_CPP03
13
14/// @defgroup bslstl_map_cpp03 bslstl_map_cpp03
15/// @brief Provide C++03 implementation for bslstl_map.h
16/// @addtogroup bsl
17/// @{
18/// @addtogroup bslstl
19/// @{
20/// @addtogroup bslstl_map_cpp03
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bslstl_map_cpp03-purpose"> Purpose</a>
25/// * <a href="#bslstl_map_cpp03-classes"> Classes </a>
26/// * <a href="#bslstl_map_cpp03-description"> Description </a>
27///
28/// # Purpose {#bslstl_map_cpp03-purpose}
29/// Provide C++03 implementation for bslstl_map.h
30///
31/// # Classes {#bslstl_map_cpp03-classes}
32/// See bslstl_map.h for list of classes
33///
34/// @see bslstl_map
35///
36/// # Description {#bslstl_map_cpp03-description}
37/// This component is the C++03 translation of a C++11 component,
38/// generated by the 'sim_cpp11_features.pl' program. If the original header
39/// contains any specially delimited regions of C++11 code, then this generated
40/// file contains the C++03 equivalent, i.e., with variadic templates expanded
41/// and rvalue-references replaced by 'bslmf::MovableRef' objects. The header
42/// code in this file is designed to be '#include'd into the original header
43/// when compiling with a C++03 compiler. If there are no specially delimited
44/// regions of C++11 code, then this header contains no code and is not
45/// '#include'd in the original header.
46///
47/// Generated on Thu Mar 5 22:50:49 2026
48/// Command line: sim_cpp11_features.pl bslstl_map.h
49/// @}
50/** @} */
51/** @} */
52
53/** @addtogroup bsl
54 * @{
55 */
56/** @addtogroup bslstl
57 * @{
58 */
59/** @addtogroup bslstl_map_cpp03
60 * @{
61 */
62
63#ifdef COMPILING_BSLSTL_MAP_H
64
65namespace bsl {
66
67 // =========
68 // class map
69 // =========
70
71/// This class template implements a value-semantic container type holding
72/// an ordered sequence of key-value pairs having unique keys that provide a
73/// mapping from keys (of the template parameter type, `KEY`) to their
74/// associated values (of another template parameter type, `VALUE`).
75///
76/// This class:
77/// * supports a complete set of *value-semantic* operations
78/// - except for BDEX serialization
79/// * is *exception-neutral*
80/// * is *alias-safe*
81/// * is `const` *thread-safe*
82/// For terminology see @ref bsldoc_glossary .
83///
84/// See @ref bslstl_map_cpp03
85template <class KEY,
86 class VALUE,
87 class COMPARATOR = std::less<KEY>,
88 class ALLOCATOR = allocator<pair<const KEY, VALUE> > >
89class map {
90
91 // PRIVATE TYPES
92
93 /// This typedef is an alias for the type of key-value pair objects
94 /// maintained by this map.
95 typedef pair<const KEY, VALUE> ValueType;
96
97 /// This typedef is an alias for the comparator used internally by this
98 /// map.
99 typedef BloombergLP::bslstl::MapComparator<KEY, VALUE, COMPARATOR>
100 Comparator;
101
102 /// This typedef is an alias for the type of nodes held by the tree (of
103 /// nodes) used to implement this map.
104 typedef BloombergLP::bslstl::TreeNode<ValueType> Node;
105
106 /// This typedef is an alias for the factory type used to create and
107 /// destroy `Node` objects.
108 typedef BloombergLP::bslstl::TreeNodePool<ValueType, ALLOCATOR>
109 NodeFactory;
110
111 /// This typedef is an alias for the allocator traits type associated
112 /// with this container.
113 typedef typename bsl::allocator_traits<ALLOCATOR> AllocatorTraits;
114
115 /// This typedef is a convenient alias for the utility associated with
116 /// movable references.
117 typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;
118
119 /// This struct is wrapper around the comparator and allocator data
120 /// members. It takes advantage of the empty-base optimization (EBO) so
121 /// that if the comparator is stateless, it takes up no space.
122 ///
123 /// TBD: This class should eventually be replaced by the use of a
124 /// general EBO-enabled component that provides a `pair`-like interface
125 /// or a `tuple`.
126 ///
127 /// See @ref bslstl_map_cpp03
128 class DataWrapper : public Comparator {
129
130 // DATA
131 NodeFactory d_pool; // pool of 'Node' objects
132
133 private:
134 // NOT IMPLEMENTED
135 DataWrapper(const DataWrapper&);
136 DataWrapper& operator=(const DataWrapper&);
137
138 public:
139 // CREATORS
140
141 /// Create a data wrapper using a copy of the specified `comparator`
142 /// to order key-value pairs and a copy of the specified
143 /// `basicAllocator` to supply memory.
144 DataWrapper(const COMPARATOR& comparator,
145 const ALLOCATOR& basicAllocator);
146
147 /// Create a data wrapper initialized to the contents of the `pool`
148 /// associated with the specified `original` data wrapper. The
149 /// comparator and allocator associated with `original` are
150 /// propagated to the new data wrapper. `original` is left in a
151 /// valid but unspecified state.
152 DataWrapper(
153 BloombergLP::bslmf::MovableRef<DataWrapper> original);// IMPLICIT
154
155 // MANIPULATORS
156
157 /// Return a reference providing modifiable access to the node
158 /// factory associated with this data wrapper.
159 NodeFactory& nodeFactory();
160
161 // ACCESSORS
162
163 /// Return a reference providing non-modifiable access to the node
164 /// factory associated with this data wrapper.
165 const NodeFactory& nodeFactory() const;
166 };
167
168 // DATA
169 DataWrapper d_compAndAlloc;
170 // comparator and pool of 'Node'
171 // objects
172
173 BloombergLP::bslalg::RbTreeAnchor d_tree; // balanced tree of 'Node'
174 // objects
175
176 public:
177 // PUBLIC TYPES
178 typedef KEY key_type;
179 typedef VALUE mapped_type;
180 typedef pair<const KEY, VALUE> value_type;
181 typedef COMPARATOR key_compare;
182 typedef ALLOCATOR allocator_type;
183 typedef value_type& reference;
184 typedef const value_type& const_reference;
185
186 typedef typename AllocatorTraits::size_type size_type;
188 typedef typename AllocatorTraits::pointer pointer;
190
191 typedef BloombergLP::bslstl::TreeIterator<
193 typedef BloombergLP::bslstl::TreeIterator<
195 typedef bsl::reverse_iterator<iterator> reverse_iterator;
196 typedef bsl::reverse_iterator<const_iterator> const_reverse_iterator;
197
198 /// This nested class defines a mechanism for comparing two objects of
199 /// `value_type` by adapting an object of (template parameter) type
200 /// `COMPARATOR`, which compares two objects of (template parameter) type `KEY` .
201 ///
202 /// \note Note that this class exactly matches its definition in
203 /// the C++11 standard [map.overview]; otherwise, we would have
204 /// implemented it as a separate component-local class.
205 ///
206 /// See @ref bslstl_map_cpp03
207 class value_compare {
208
209 // FRIENDS
210 friend class map;
211
212 protected:
213 // PROTECTED DATA
214 COMPARATOR comp; // we would not have elected to make this data
215 // member 'protected'
216
217 // PROTECTED CREATORS
218
219 /// Create a @ref value_compare object that uses the specified
220 /// `comparator`.
221 value_compare(COMPARATOR comparator); // IMPLICIT
222
223 public:
224 // PUBLIC TYPES
225
226 /// This `typedef` is an alias for the result type of a call to the
227 /// overload of `operator()` (the comparison function) provided by a
228 /// `map::value_compare` object.
229 typedef bool result_type;
230
231 /// This `typedef` is an alias for the type of the first parameter
232 /// of the overload of `operator()` (the comparison function)
233 /// provided by a `map::value_compare` object.
235
236 /// This `typedef` is an alias for the type of the second parameter
237 /// of the overload of `operator()` (the comparison function)
238 /// provided by a `map::value_compare` object.
240
241 // CREATORS
242 value_compare(const value_compare& original) = default;
243 // Create a @ref value_compare object having the same value as the
244 // specified 'original' object.
245
246 ~value_compare() = default;
247 // Destroy this object.
248
249 // MANIPULATORS
250 value_compare& operator=(const value_compare& rhs) = default;
251 // Assign to this object the value of the specified 'rhs' object,
252 // and return a reference providing modifiable access to this
253 // object.
254
255 // ACCESSORS
256
257 /// Return `true` if the specified `x` object is ordered before the
258 /// specified `y` object, as determined by the comparator supplied
259 /// at construction, and `false` otherwise.
260 bool operator()(const value_type& x, const value_type& y) const;
261 };
262
263 private:
264 // PRIVATE CLASS METHODS
265
266 /// Return an address providing modifiable access to the specified `node`.
267 ///
268 /// \pre The behavior is undefined unless `node` is the address of a
269 /// `Node` object.
270 static Node *toNode(BloombergLP::bslalg::RbTreeNode *node);
271
272 /// Return an address providing non-modifiable access to the specified `node`.
273 ///
274 /// \pre The behavior is undefined unless `node` is the address of a
275 /// `Node` object.
276 static const Node *toNode(const BloombergLP::bslalg::RbTreeNode *node);
277
278 // PRIVATE MANIPULATORS
279
280 /// Return a reference providing modifiable access to the node allocator
281 /// for this map.
282 NodeFactory& nodeFactory();
283
284 /// Return a reference providing modifiable access to the comparator for
285 /// this map.
286 Comparator& comparator();
287
288 /// Efficiently exchange the value, comparator, and allocator of this
289 /// object with the value, comparator, and allocator of the specified
290 /// `other` object. This method provides the no-throw exception-safety
291 /// guarantee, *unless* swapping the (user-supplied) comparator or
292 /// allocator objects can throw.
293 void quickSwapExchangeAllocators(map& other);
294
295 /// Efficiently exchange the value and comparator of this object with
296 /// the value and comparator of the specified `other` object. This
297 /// method provides the no-throw exception-safety guarantee, *unless*
298 /// swapping the (user-supplied) comparator objects can throw.
299 ///
300 /// \pre The behavior is undefined unless this object was created with the same
301 /// allocator as `other`.
302 void quickSwapRetainAllocators(map& other);
303
304 /// Insert the values between the specified `first` and `last` into an
305 /// initially empty map. If sorted, directly place each value in its
306 /// proper position. If an out of order value is detected, revert to
307 /// normal insertion.
308 template <class INPUT_ITERATOR, class SENTINEL>
309 void constructFromRange(INPUT_ITERATOR first, SENTINEL last);
310
311#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
312 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
313
314 /// Insert the values between the specified `first` and `last` into an
315 /// initially empty map. The specified 'numElements` is used to improve
316 /// performance. If sorted, directly place each value in its proper
317 /// position. If an out of order value is detected, revert to normal insertion.
318 ///
319 /// \pre The behavior is undefined if the iterators support
320 /// the calculation of distance and `numElements` is not the distance
321 /// from `first` to `last`.
322 template <class INPUT_ITERATOR, class SENTINEL>
323 void constructFromRange(INPUT_ITERATOR first,
324 SENTINEL last,
325 size_t numElements);
326#endif
327
328 // Insert the values between `first` and `last` into this map.
329 template <class INPUT_ITERATOR, class SENTINEL>
330 void insertFromRange(INPUT_ITERATOR first,
331 SENTINEL last);
332
333#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
334 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
335
336 /// Insert the values between the specified `first` and `last` into this
337 /// map. The specified `numElements` is used to improve performance.
338 ///
339 /// \pre The behavior is undefined if the iterators support the calculation
340 /// of distance and `numElements` is not the distance from `first` to
341 /// `last`.
342 template <class INPUT_ITERATOR, class SENTINEL>
343 void insertFromRange(INPUT_ITERATOR first,
344 SENTINEL last,
345 size_t numElements);
346#endif
347
348 // PRIVATE ACCESSORS
349
350 /// Return a reference providing non-modifiable access to the node
351 /// allocator for this map.
352 const NodeFactory& nodeFactory() const;
353
354 /// Return a reference providing non-modifiable access to the comparator
355 /// for this map.
356 const Comparator& comparator() const;
357
358 public:
359 // CREATORS
360
361 /// Create an empty map. Optionally specify a `comparator` used to
362 /// order key-value pairs contained in this object. If `comparator` is
363 /// not supplied, a default-constructed object of the (template
364 /// parameter) type `COMPARATOR` is used. Optionally specify a
365 /// `basicAllocator` used to supply memory. If `basicAllocator` is not
366 /// supplied, a default-constructed object of the (template parameter)
367 /// type `ALLOCATOR` is used. If the type `ALLOCATOR` is
368 /// `bsl::allocator` (the default), then `basicAllocator`, if supplied,
369 /// shall be convertible to `bslma::Allocator *`. If the type
370 /// `ALLOCATOR` is `bsl::allocator` and `basicAllocator` is not
371 /// supplied, the currently installed default allocator is used.
372 map();
373 explicit map(const COMPARATOR& comparator,
374 const ALLOCATOR& basicAllocator = ALLOCATOR())
375 : d_compAndAlloc(comparator, basicAllocator)
376 , d_tree()
377 {
378 // The implementation is placed here in the class definition to work
379 // around an AIX compiler bug, where the constructor can fail to
380 // compile because it is unable to find the definition of the default
381 // argument. This occurs when a parameterized class wraps around the
382 // container and the comparator is defined after the new class.
383 }
384
385 /// Create an empty map that uses the specified `basicAllocator` to
386 /// supply memory. Use a default-constructed object of the (template
387 /// parameter) type `COMPARATOR` to order the key-value pairs contained in this map.
388 ///
389 /// \note Note that a `bslma::Allocator *` can be supplied for
390 /// `basicAllocator` if the (template parameter) `ALLOCATOR` is
391 /// `bsl::allocator` (the default).
392 explicit map(const ALLOCATOR& basicAllocator);
393
394 /// Create a map having the same value as the specified `original`
395 /// object. Use a copy of `original.key_comp()` to order the key-value
396 /// pairs contained in this map. Use the allocator returned by
397 /// 'bsl::allocator_traits<ALLOCATOR>::
398 /// select_on_container_copy_construction(original.get_allocator())' to
399 /// allocate memory. If the (template parameter) type `ALLOCATOR` is
400 /// `bsl::allocator` (the default), the currently installed default
401 /// allocator is used. This method requires that the (template
402 /// parameter) types `KEY` and `VALUE` both be `copy-insertable` into
403 /// this map (see {Requirements on `KEY` and `VALUE`}).
404 map(const map& original);
405
406 /// Create a map having the same value as the specified `original`
407 /// object by moving (in constant time) the contents of `original` to
408 /// the new map. Use a copy of `original.key_comp()` to order the
409 /// key-value pairs contained in this map. The allocator associated
410 /// with `original` is propagated for use in the newly-created map.
411 /// `original` is left in a valid but unspecified state.
412 map(BloombergLP::bslmf::MovableRef<map> original); // IMPLICIT
413
414 /// Create a map having the same value as the specified `original`
415 /// object that uses the specified `basicAllocator` to supply memory.
416 /// Use a copy of `original.key_comp()` to order the key-value pairs
417 /// contained in this map. This method requires that the (template
418 /// parameter) types `KEY` and `VALUE` both be `copy-insertable` into this map (see {Requirements on `KEY` and `VALUE`}).
419 ///
420 /// \note Note that a
421 /// `bslma::Allocator *` can be supplied for `basicAllocator` if the
422 /// (template parameter) `ALLOCATOR` is `bsl::allocator` (the default).
423 map(const map& original,
424 const typename type_identity<ALLOCATOR>::type& basicAllocator);
425
426 /// Create a map having the same value as the specified `original`
427 /// object that uses the specified `basicAllocator` to supply memory.
428 /// The contents of `original` are moved (in constant time) to the new
429 /// map if `basicAllocator == original.get_allocator()`, and are move-
430 /// inserted (in linear time) using `basicAllocator` otherwise.
431 /// `original` is left in a valid but unspecified state. Use a copy of
432 /// `original.key_comp()` to order the key-value pairs contained in this
433 /// map. This method requires that the (template parameter) types `KEY`
434 /// and `VALUE` both be `move-insertable` into this map (see {Requirements on `KEY` and `VALUE`}).
435 ///
436 /// \note Note that a
437 /// `bslma::Allocator *` can be supplied for `basicAllocator` if the
438 /// (template parameter) `ALLOCATOR` is `bsl::allocator` (the default).
439 map(BloombergLP::bslmf::MovableRef<map> original,
440 const typename type_identity<ALLOCATOR>::type& basicAllocator);
441
442 /// Create a map, and insert each `value_type` object in the sequence
443 /// starting at the specified `first` element, and ending immediately
444 /// before the specified `last` element, ignoring those objects having a
445 /// key equivalent to that which appears earlier in the sequence.
446 /// Optionally specify a `comparator` used to order key-value pairs
447 /// contained in this object. If `comparator` is not supplied, a
448 /// default-constructed object of the (template parameter) type
449 /// `COMPARATOR` is used. Optionally specify a `basicAllocator` used to
450 /// supply memory. If `basicAllocator` is not supplied, a
451 /// default-constructed object of the (template parameter) type
452 /// `ALLOCATOR` is used. If the type `ALLOCATOR` is `bsl::allocator`
453 /// (the default), then `basicAllocator`, if supplied, shall be
454 /// convertible to `bslma::Allocator *`. If the type `ALLOCATOR` is
455 /// `bsl::allocator` and `basicAllocator` is not supplied, the currently
456 /// installed default allocator is used. If the sequence `first` to
457 /// `last` is ordered according to `comparator`, then this operation has
458 /// `O[N]` complexity, where `N` is the number of elements between
459 /// `first` and `last`; otherwise, this operation has `O[N * log(N)]`
460 /// complexity.
461 ///
462 /// The (template parameter) type `INPUT_ITERATOR` shall
463 /// meet the requirements of an input iterator defined in the C++11
464 /// standard [input.iterators] providing access to values of a type
465 /// convertible to `value_type`, and `value_type` must be
466 /// `emplace-constructible` from `*i` into this map, where `i` is a
467 /// dereferenceable iterator in the range `[first .. last)` (see
468 /// {Requirements on `KEY` and `VALUE`}).
469 ///
470 /// \pre The behavior is undefined unless `first` and `last` refer to a sequence of valid values where
471 /// `first` is at a position at or before `last`.
472 template <class INPUT_ITERATOR>
473 map(INPUT_ITERATOR first,
474 INPUT_ITERATOR last,
475 const COMPARATOR& comparator = COMPARATOR(),
476 const ALLOCATOR& basicAllocator = ALLOCATOR());
477 template <class INPUT_ITERATOR>
478 map(INPUT_ITERATOR first,
479 INPUT_ITERATOR last,
480 const ALLOCATOR& basicAllocator);
481
482 /// Create a map having the (`value_type`) values obtained from the
483 /// specified `range`. Ignore those those objects having a key equivalent
484 /// to that which appears earlier in the sequence. Optionally specify a
485 /// `comparator` used to order key-value pairs contained in this object.
486 /// If `comparator` is not supplied, a default-constructed object of the
487 /// (template parameter) type `COMPARATOR` is used. Optionally specify a
488 /// `basicAllocator` used to supply memory. If `basicAllocator` is not
489 /// supplied, a default-constructed object of the (template parameter) type
490 /// `ALLOCATOR` is used. If the type `ALLOCATOR` is `bsl::allocator`
491 /// (the default), then `basicAllocator`, if supplied, shall be
492 /// convertible to `bslma::Allocator *`. If the type `ALLOCATOR` is
493 /// `bsl::allocator` and `basicAllocator` is not supplied, the currently
494 /// installed default allocator is used. If values obtained from `range
495 /// are ordered according to `comparator`, then this operation has `O[N]`
496 /// complexity, where `N` is the number of values in the `range`;
497 /// otherwise, this operation has `O[N * log(N)]` complexity.
498 ///
499 /// \note Note that `RANGE` must meet the requirements of an input range and the values
500 /// from `range` must have a type matching or convertible to `value_type`.
501 template <class RANGE>
505 const COMPARATOR& comparator = COMPARATOR(),
506 const ALLOCATOR& basicAllocator = ALLOCATOR())
507 : d_compAndAlloc(comparator, basicAllocator)
508 , d_tree()
509 {
510 // Defined inline to avoid Windows errors.
511
512#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
513 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
514 if constexpr (ranges::sized_range<RANGE>) {
515 constructFromRange(bsl::ranges::begin(range),
516 bsl::ranges::end (range),
517 bsl::ranges::size (range));
518 } else // ...
519#endif
520 {
521 constructFromRange(bsl::ranges::begin(range),
522 bsl::ranges::end (range));
523 }
524 }
525
526 template <class RANGE>
528 map(from_range_t ,
530 const ALLOCATOR& basicAllocator)
531 : d_compAndAlloc(COMPARATOR(), basicAllocator)
532 , d_tree()
533 {
534 // Defined inline to avoid Windows errors.
535
536 map other(bsl::from_range,
537 range,
538 COMPARATOR(),
539 nodeFactory().allocator());
540 quickSwapRetainAllocators(other);
541 }
542
543#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
544 /// Create a map and insert each `value_type` object in the specified
545 /// `values` initializer list, ignoring those objects having a key
546 /// equivalent to that which appears earlier in the list. Optionally
547 /// specify a `comparator` used to order keys contained in this object.
548 /// If `comparator` is not supplied, a default-constructed object of the
549 /// (template parameter) type `COMPARATOR` is used. Optionally specify
550 /// a `basicAllocator` used to supply memory. If `basicAllocator` is
551 /// not supplied, a default-constructed object of the (template
552 /// parameter) type `ALLOCATOR` is used. If the type `ALLOCATOR` is
553 /// `bsl::allocator` (the default), then `basicAllocator`, if supplied,
554 /// shall be convertible to `bslma::Allocator *`. If the type
555 /// `ALLOCATOR` is `bsl::allocator` and `basicAllocator` is not
556 /// supplied, the currently installed default allocator is used. If
557 /// `values` is ordered according to `comparator`, then this operation
558 /// has `O[N]` complexity, where `N` is the number of elements in
559 /// `values`; otherwise, this operation has `O[N * log(N)]` complexity.
560 /// This method requires that the (template parameter) types `KEY` and
561 /// `VALUE` both be `copy-insertable` into this map (see {Requirements
562 /// on `KEY` and `VALUE`}).
563 map(std::initializer_list<value_type> values,
564 const COMPARATOR& comparator = COMPARATOR(),
565 const ALLOCATOR& basicAllocator = ALLOCATOR());
566 map(std::initializer_list<value_type> values,
567 const ALLOCATOR& basicAllocator);
568#endif
569
570 /// Destroy this object.
571 ~map();
572
573 // MANIPULATORS
574
575 /// Assign to this object the value and comparator of the specified
576 /// `rhs` object, propagate to this object the allocator of `rhs` if the
577 /// `ALLOCATOR` type has trait @ref propagate_on_container_copy_assignment ,
578 /// and return a reference providing modifiable access to this object.
579 /// If an exception is thrown, `*this` is left in a valid but
580 /// unspecified state. This method requires that the (template
581 /// parameter) types `KEY` and `VALUE` both be `copy-assignable` and
582 /// `copy-insertable` into this map (see {Requirements on `KEY` and
583 /// `VALUE`}).
584 map& operator=(const map& rhs);
585
586 map& operator=(BloombergLP::bslmf::MovableRef<map> rhs)
588 AllocatorTraits::is_always_equal::value &&
589 std::is_nothrow_move_assignable<COMPARATOR>::value);
590 // Assign to this object the value and comparator of the specified
591 // 'rhs' object, propagate to this object the allocator of 'rhs' if the
592 // 'ALLOCATOR' type has trait @ref propagate_on_container_move_assignment ,
593 // and return a reference providing modifiable access to this object.
594 // The contents of 'rhs' are moved (in constant time) to this map if
595 // 'get_allocator() == rhs.get_allocator()' (after accounting for the
596 // aforementioned trait); otherwise, all elements in this map are
597 // either destroyed or move-assigned to and each additional element in
598 // 'rhs' is move-inserted into this map. 'rhs' is left in a valid but
599 // unspecified state, and if an exception is thrown, '*this' is left
600 // in a valid but unspecified state. This method requires that the
601 // (template parameter) types 'KEY' and 'VALUE' both be
602 // 'move-assignable' and 'move-insertable' into this map (see
603 // {Requirements on 'KEY' and 'VALUE'}).
604
605#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
606 /// Assign to this object the value resulting from first clearing this
607 /// map and then inserting each `value_type` object in the specified
608 /// `values` initializer list, ignoring those objects having a key
609 /// equivalent to that which appears earlier in the list; return a
610 /// reference providing modifiable access to this object. This method
611 /// requires that the (template parameter) types `KEY` and `VALUE` both
612 /// be `copy-insertable` into this map (see {Requirements on `KEY` and
613 /// `VALUE`}).
614 map& operator=(std::initializer_list<value_type> values);
615#endif
616
617 /// Return a reference providing modifiable access to the mapped-value
618 /// associated with the specified `key`; if this `map` does not already
619 /// contain a `value_type` object having an equivalent key, first insert
620 /// a new `value_type` object having `key` and a default-constructed
621 /// `VALUE` object, and return a reference to the newly mapped (default)
622 /// value. This method requires that the (template parameter) type
623 /// `KEY` be `copy-insertable` into this map and the (template
624 /// parameter) type `VALUE` be `default-insertable` into this map (see
625 /// {Requirements on `KEY` and `VALUE`}).
627
628 /// Return a reference providing modifiable access to the mapped-value
629 /// associated with the specified `key`; if this `map` does not already
630 /// contain a `value_type` object having an equivalent key, first insert
631 /// a new `value_type` object having the move-inserted `key` and a
632 /// default-constructed `VALUE` object, and return a reference to the
633 /// newly mapped (default) value. This method requires that the
634 /// (template parameter) type `KEY` be `move-insertable` into this map
635 /// and the (template parameter) type `VALUE` be `default-insertable`
636 /// into this map (see {Requirements on `KEY` and `VALUE`}).
638 BloombergLP::bslmf::MovableRef<key_type> key);
639
640// {{{ BEGIN GENERATED CODE
641// The generated code below is a workaround for the absence of perfect
642// forwarding in some compilers.
643 template <class LOOKUP_KEY>
644 typename bsl::enable_if<
645 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
646 LOOKUP_KEY>::value,
649 {
650
651 return try_emplace(
652 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key)).first->second;
653 }
654// }}} END GENERATED CODE
655
656 /// Return a reference providing modifiable access to the mapped-value
657 /// associated with the specified `key`, if such an entry exists; otherwise, throw a `std::out_of_range` exception.
658 ///
659 /// \note Note that this
660 /// method may also throw a different kind of exception if the
661 /// (user-supplied) comparator throws.
662 typename add_lvalue_reference<VALUE>::type at(const key_type& key);
663
664 /// Return a reference providing modifiable access to the
665 /// mapped-value associated with a key that is equivalent to the
666 /// specified `key`, if such an entry exists; otherwise, throw a `std::out_of_range` exception.
667 ///
668 /// \note Note that this method may also throw
669 /// a different kind of exception if the (user-supplied) comparator
670 /// throws.
671 template <class LOOKUP_KEY>
672 typename bsl::enable_if<
673 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
674 LOOKUP_KEY>::value,
676 at(const LOOKUP_KEY& key) {
677 // Note: implemented inline due to Sun CC compilation error.
678
679 iterator iter = find(key);
680 if (iter == end()) {
681 BloombergLP::bslstl::StdExceptUtil::throwOutOfRange(
682 "map<...>::at(LOOKUP_KEY): invalid key value");
683 }
684 return iter->second;
685 }
686
687 /// Return an iterator providing modifiable access to the first
688 /// `value_type` object in the ordered sequence of `value_type` objects
689 /// maintained by this map, or the `end` iterator if this map is empty.
691
692 /// Return an iterator providing modifiable access to the past-the-end
693 /// element in the ordered sequence of `value_type` objects maintained
694 /// by this map.
696
697 /// Return a reverse iterator providing modifiable access to the last
698 /// `value_type` object in the ordered sequence of `value_type` objects
699 /// maintained by this map, or `rend` if this map is empty.
701
702 /// Return a reverse iterator providing modifiable access to the
703 /// prior-to-the-beginning element in the ordered sequence of
704 /// `value_type` objects maintained by this map.
706
707 /// Insert the specified `value` into this map if a key (the `first`
708 /// element) equivalent to that of `value` does not already exist in
709 /// this map; otherwise, if a `value_type` object whose key is
710 /// equivalent to that of `value` already exists in this map, this
711 /// method has no effect. Return a pair whose `first` member is an
712 /// iterator referring to the (possibly newly inserted) `value_type`
713 /// object in this map whose key is equivalent to that of `value`, and
714 /// whose `second` member is `true` if a new value was inserted, and
715 /// `false` if the key was already present. This method requires that
716 /// the (template parameter) types `KEY` and `VALUE` both be
717 /// `copy-insertable` into this map (see {Requirements on `KEY` and
718 /// `VALUE`}).
719 pair<iterator, bool> insert(const value_type& value);
720
721 /// Insert into this map the specified `value` if a key (the `first`
722 /// element) equivalent to that of `value` does not already exist in
723 /// this map; otherwise, this method has no effect. Return a pair whose
724 /// `first` member is an iterator referring to the (possibly newly
725 /// inserted) `value_type` object in this map whose key is equivalent to
726 /// that of `value`, and whose `second` member is `true` if a new value
727 /// was inserted and `false` if the key was already present. This
728 /// method requires that the (template parameter) types `KEY` and
729 /// `VALUE` both be `move-insertable` into this map (see {Requirements
730 /// on `KEY` and `VALUE`}).
731 pair<iterator, bool> insert(
732 BloombergLP::bslmf::MovableRef<value_type> value);
733
734#if defined(BSLS_PLATFORM_CMP_SUN) && BSLS_PLATFORM_CMP_VERSION < 0x5130
735 template <class ALT_VALUE_TYPE>
736 pair<iterator, bool>
737#elif !defined(BSLS_COMPILERFEATURES_SUPPORT_TRAITS_HEADER)
738 template <class ALT_VALUE_TYPE>
739 typename enable_if<is_convertible<ALT_VALUE_TYPE, value_type>::value,
740 pair<iterator, bool> >::type
741#else
742 /// Insert into this map a `value_type` object created from the
743 /// specified `value` if a key (the `first` element) equivalent to that
744 /// of such an object does not already exist in this map; otherwise,
745 /// this method has no effect (other than possibly creating a temporary
746 /// `value_type` object). Return a pair whose `first` member is an
747 /// iterator referring to the (possibly newly inserted) `value_type`
748 /// object in this map whose key is equivalent to that of the object
749 /// created from `value`, and whose `second` member is `true` if a new
750 /// value was inserted and `false` if the key was already present. This
751 /// method requires that the (template parameter) types `KEY` and
752 /// `VALUE` both be `move-insertable` into this map (see {Requirements
753 /// on `KEY` and `VALUE`}), and the `value_type` be constructible from
754 /// the (template parameter) `ALT_VALUE_TYPE`.
755 template <class ALT_VALUE_TYPE>
756 typename enable_if<std::is_constructible<value_type,
757 ALT_VALUE_TYPE&&>::value,
758 pair<iterator, bool> >::type
759#endif
760 insert(BSLS_COMPILERFEATURES_FORWARD_REF(ALT_VALUE_TYPE) value)
761 {
762 // This function has to be implemented inline, in violation of BDE
763 // convention, as the MSVC compiler cannot match the out-of-class
764 // definition of the declaration in the class.
765
766 return emplace(BSLS_COMPILERFEATURES_FORWARD(ALT_VALUE_TYPE, value));
767 }
768
769 /// Insert the specified `value` into this map (in amortized constant
770 /// time if the specified `hint` is a valid immediate successor to the
771 /// key of `value`) if a key (the `first` element) equivalent to that of
772 /// `value` does not already exist in this map; otherwise, if a
773 /// `value_type` object whose key is equivalent to that of `value`
774 /// already exists in this map, this method has no effect. Return an
775 /// iterator referring to the (possibly newly inserted) `value_type`
776 /// object in this map whose key is equivalent to that of `value`. If
777 /// `hint` is not a valid immediate successor to the key of `value`,
778 /// this operation has `O[log(N)]` complexity, where `N` is the size of
779 /// this map. This method requires that the (template parameter) types
780 /// `KEY` and `VALUE` both be `copy-insertable` into this map (see
781 /// {Requirements on `KEY` and `VALUE`}).
782 ///
783 /// \pre The behavior is undefined unless `hint` is an iterator in the range `[begin() .. end()]` (both
784 /// endpoints included).
785 iterator insert(const_iterator hint, const value_type& value);
786
787 /// Insert into this map the specified `value` (in amortized constant
788 /// time if the specified `hint` is a valid immediate successor to
789 /// `value`) if a key (the `first` element) equivalent to that of
790 /// `value` does not already exist in this map; otherwise, this method
791 /// has no effect. Return an iterator referring to the (possibly newly
792 /// inserted) `value_type` object in this map whose key is equivalent to
793 /// that of `value`. If `hint` is not a valid immediate successor to
794 /// `value`, this operation has `O[log(N)]` complexity, where `N` is the
795 /// size of this map. This method requires that the (template
796 /// parameter) types `KEY` and `VALUE` both be `move-insertable` into
797 /// this map (see {Requirements on `KEY` and `VALUE`}).
798 ///
799 /// \pre The behavior is undefined unless `hint` is an iterator in the range
800 /// `[begin() .. end()]` (both endpoints included).
802 BloombergLP::bslmf::MovableRef<value_type> value);
803
804#if defined(BSLS_PLATFORM_CMP_SUN) && BSLS_PLATFORM_CMP_VERSION < 0x5130
805 template <class ALT_VALUE_TYPE>
807#elif !defined(BSLS_COMPILERFEATURES_SUPPORT_TRAITS_HEADER)
808 template <class ALT_VALUE_TYPE>
809 typename enable_if<is_convertible<ALT_VALUE_TYPE, value_type>::value,
810 iterator>::type
811#else
812 /// Insert into this map a `value_type` object created from the
813 /// specified `value` (in amortized constant time if the specified
814 /// `hint` is a valid immediate successor to the object created from
815 /// `value`) if a key (the `first` element) equivalent to such an object
816 /// does not already exist in this map; otherwise, this method has no
817 /// effect (other than possibly creating a temporary `value_type`
818 /// object). Return an iterator referring to the (possibly newly
819 /// inserted) `value_type` object in this map whose key is equivalent to
820 /// that of the object created from `value`. If `hint` is not a valid
821 /// immediate successor to the object created from `value`, this
822 /// operation has `O[log(N)]` complexity, where `N` is the size of this
823 /// map. This method requires that the (template parameter) types `KEY`
824 /// and `VALUE` both be `move-insertable` into this map (see
825 /// {Requirements on `KEY` and `VALUE`}), and the `value_type` be
826 /// constructible from the (template parameter) `ALT_VALUE_TYPE`.
827 ///
828 /// \pre The behavior is undefined unless `hint` is an iterator in the range
829 /// `[begin() .. end()]` (both endpoints included).
830 template <class ALT_VALUE_TYPE>
831 typename enable_if<std::is_constructible<value_type,
832 ALT_VALUE_TYPE&&>::value,
833 iterator>::type
834#endif
836 BSLS_COMPILERFEATURES_FORWARD_REF(ALT_VALUE_TYPE) value)
837 {
838 // This function has to be implemented inline, in violation of BDE
839 // convention, as the MSVC compiler cannot match the out-of-class
840 // definition of the declaration in the class.
841
842 return emplace_hint(
843 hint,
844 BSLS_COMPILERFEATURES_FORWARD(ALT_VALUE_TYPE, value));
845 }
846
847 /// Insert into this map the value of each `value_type` object in the
848 /// range starting at the specified `first` iterator and ending
849 /// immediately before the specified `last` iterator, if a key
850 /// equivalent to that of the object is not already contained in this
851 /// map. The (template parameter) type `INPUT_ITERATOR` shall meet the
852 /// requirements of an input iterator defined in the C++11 standard
853 /// [input.iterators] providing access to values of a type convertible
854 /// to `value_type`, and `value_type` must be `emplace-constructible`
855 /// from `*i` into this map, where `i` is a dereferenceable iterator in
856 /// the range `[first .. last)` (see {Requirements on `KEY` and `VALUE`}).
857 ///
858 /// \pre The behavior is undefined unless `first` and `last`
859 /// refer to a sequence of valid values where `first` is at a position
860 /// at or before `last`.
861 template <class INPUT_ITERATOR>
862 void insert(INPUT_ITERATOR first, INPUT_ITERATOR last);
863
864 /// Insert into this map the value of each `value_type` object in the
865 /// specified `range` if the key equivalent of that object is not
866 /// already contained in this map. The (template parameter) type `RANGE`
867 /// must meet the requirements the C++20 standard [ranges] providing access
868 /// to values of a type convertible to `value_type`, and `value_type` must
869 /// be `emplace-constructible` from `*i` into this map, where `i` is a
870 /// dereferenceable iterator obtained from `range` (see {Requirements on `KEY` and `VALUE`}).
871 ///
872 /// \pre The behavior is undefined if `range` overlaps
873 /// this map.
874 template <class RANGE>
877 {
878 // Defined inline to avoid Windows errors.
879
880#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
881 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
882 if constexpr (ranges::sized_range<RANGE>) {
883 insertFromRange(bsl::ranges::begin(range),
884 bsl::ranges::end (range),
885 bsl::ranges::size (range));
886 } else // ...
887#endif
888 {
889 insertFromRange(bsl::ranges::begin(range),
890 bsl::ranges::end (range));
891 }
892 }
893
894#if defined(BSLS_PLATFORM_CMP_SUN) && BSLS_PLATFORM_CMP_VERSION < 0x5130
895 void insert(const_iterator first, const_iterator last);
896 // This method is provided only on Sun to work around a bug in the Sun
897 // Studio 12.3 compiler, which prevents us from disabling (at compile
898 // time) the overload of 'insert' taking a 'const_iterator' and a
899 // forwarding reference if the second argument is not convertible to
900 // the value type associated with the map. Without such a check, in
901 // certain cases, the same compiler complains of ambiguity between
902 // the 'insert' method taking two input iterators and the 'insert'
903 // method taking a 'const_iterator' and a forwarding reference; such
904 // an ambiguity is resolved by providing this method, which is
905 // equivalent to the 'insert' method (above) taking two input iterators
906 // of template parameter type.
907#endif
908
909#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
910 /// Insert into this map the value of each `value_type` object in the
911 /// specified `values` initializer list if a key equivalent to that of
912 /// the object is not already contained in this map. This method
913 /// requires that the (template parameter) types `KEY` and `VALUE` both
914 /// be `copy-insertable` into this map (see {Requirements on `KEY` and
915 /// `VALUE`}).
916 void insert(std::initializer_list<value_type> values);
917#endif
918
919// {{{ BEGIN GENERATED CODE
920// The generated code below is a workaround for the absence of perfect
921// forwarding in some compilers.
922 template <class BDE_OTHER_TYPE>
923 pair<iterator, bool> insert_or_assign(const KEY& key,
924 BSLS_COMPILERFEATURES_FORWARD_REF(BDE_OTHER_TYPE) obj);
925
926 template <class BDE_OTHER_TYPE>
927 pair<iterator, bool> insert_or_assign(
928 BloombergLP::bslmf::MovableRef<KEY> key,
929 BSLS_COMPILERFEATURES_FORWARD_REF(BDE_OTHER_TYPE) obj);
930
931 template<class LOOKUP_KEY, class BDE_OTHER_TYPE>
932 typename bsl::enable_if<
933 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
934 LOOKUP_KEY>::value,
935 pair<iterator, bool> >::type
937 BSLS_COMPILERFEATURES_FORWARD_REF(BDE_OTHER_TYPE) obj)
938 {
939
940 typedef pair<iterator, bool> Result;
941
942 int comparisonResult;
943 BloombergLP::bslalg::RbTreeNode *insertLocation =
944 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
945 &comparisonResult,
946 &d_tree,
947 this->comparator(),
948 key);
949
950 if (!comparisonResult) {
951 iterator(insertLocation)->second =
952 BSLS_COMPILERFEATURES_FORWARD(BDE_OTHER_TYPE, obj);
953 return Result(iterator(insertLocation), false);
954 }
955
956 BloombergLP::bslalg::RbTreeNode *node =
957 nodeFactory().emplaceIntoNewNode(
958 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key),
959 BSLS_COMPILERFEATURES_FORWARD(BDE_OTHER_TYPE, obj));
960
961 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
962 insertLocation,
963 comparisonResult < 0,
964 node);
965
966 return Result(iterator(node), true);
967 }
968
969 template <class BDE_OTHER_TYPE>
971 const KEY& key,
972 BSLS_COMPILERFEATURES_FORWARD_REF(BDE_OTHER_TYPE) obj);
973
974 template <class BDE_OTHER_TYPE>
976 BloombergLP::bslmf::MovableRef<KEY> key,
977 BSLS_COMPILERFEATURES_FORWARD_REF(BDE_OTHER_TYPE) obj);
978
979 template<class LOOKUP_KEY, class BDE_OTHER_TYPE>
980 typename bsl::enable_if<
981 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
982 LOOKUP_KEY>::value,
983 iterator>::type
985 BSLS_COMPILERFEATURES_FORWARD_REF(LOOKUP_KEY) key,
986 BSLS_COMPILERFEATURES_FORWARD_REF(BDE_OTHER_TYPE) obj)
987 {
988
989 BloombergLP::bslalg::RbTreeNode *hintNode =
990 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
991
992 int comparisonResult;
993 BloombergLP::bslalg::RbTreeNode *insertLocation =
994 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
995 &comparisonResult,
996 &d_tree,
997 this->comparator(),
998 key,
999 hintNode);
1000
1001 if (!comparisonResult) {
1002 iterator(insertLocation)->second =
1003 BSLS_COMPILERFEATURES_FORWARD(BDE_OTHER_TYPE, obj);
1004 return iterator(insertLocation);
1005 }
1006
1007 BloombergLP::bslalg::RbTreeNode *node =
1008 nodeFactory().emplaceIntoNewNode(
1009 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key),
1010 BSLS_COMPILERFEATURES_FORWARD(BDE_OTHER_TYPE, obj));
1011
1012 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
1013 insertLocation,
1014 comparisonResult < 0,
1015 node);
1016
1017 return iterator(node);
1018 }
1019// }}} END GENERATED CODE
1020
1021#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1022// {{{ BEGIN GENERATED CODE
1023// Command line: sim_cpp11_features.pl bslstl_map.h
1024#ifndef BSLSTL_MAP_VARIADIC_LIMIT
1025#define BSLSTL_MAP_VARIADIC_LIMIT 10
1026#endif
1027#ifndef BSLSTL_MAP_VARIADIC_LIMIT_C
1028#define BSLSTL_MAP_VARIADIC_LIMIT_C BSLSTL_MAP_VARIADIC_LIMIT
1029#endif
1030#if BSLSTL_MAP_VARIADIC_LIMIT_C >= 0
1031 pair<iterator, bool> emplace(
1032 );
1033#endif // BSLSTL_MAP_VARIADIC_LIMIT_C >= 0
1034
1035#if BSLSTL_MAP_VARIADIC_LIMIT_C >= 1
1036 template <class Args_01>
1037 pair<iterator, bool> emplace(
1038 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01);
1039#endif // BSLSTL_MAP_VARIADIC_LIMIT_C >= 1
1040
1041#if BSLSTL_MAP_VARIADIC_LIMIT_C >= 2
1042 template <class Args_01,
1043 class Args_02>
1044 pair<iterator, bool> emplace(
1045 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1046 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02);
1047#endif // BSLSTL_MAP_VARIADIC_LIMIT_C >= 2
1048
1049#if BSLSTL_MAP_VARIADIC_LIMIT_C >= 3
1050 template <class Args_01,
1051 class Args_02,
1052 class Args_03>
1053 pair<iterator, bool> emplace(
1054 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1055 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1056 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03);
1057#endif // BSLSTL_MAP_VARIADIC_LIMIT_C >= 3
1058
1059#if BSLSTL_MAP_VARIADIC_LIMIT_C >= 4
1060 template <class Args_01,
1061 class Args_02,
1062 class Args_03,
1063 class Args_04>
1064 pair<iterator, bool> emplace(
1065 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1066 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1067 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1068 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04);
1069#endif // BSLSTL_MAP_VARIADIC_LIMIT_C >= 4
1070
1071#if BSLSTL_MAP_VARIADIC_LIMIT_C >= 5
1072 template <class Args_01,
1073 class Args_02,
1074 class Args_03,
1075 class Args_04,
1076 class Args_05>
1077 pair<iterator, bool> emplace(
1078 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1079 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1080 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1081 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1082 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05);
1083#endif // BSLSTL_MAP_VARIADIC_LIMIT_C >= 5
1084
1085#if BSLSTL_MAP_VARIADIC_LIMIT_C >= 6
1086 template <class Args_01,
1087 class Args_02,
1088 class Args_03,
1089 class Args_04,
1090 class Args_05,
1091 class Args_06>
1092 pair<iterator, bool> emplace(
1093 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1094 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1095 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1096 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1097 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1098 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06);
1099#endif // BSLSTL_MAP_VARIADIC_LIMIT_C >= 6
1100
1101#if BSLSTL_MAP_VARIADIC_LIMIT_C >= 7
1102 template <class Args_01,
1103 class Args_02,
1104 class Args_03,
1105 class Args_04,
1106 class Args_05,
1107 class Args_06,
1108 class Args_07>
1109 pair<iterator, bool> emplace(
1110 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1111 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1112 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1113 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1114 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1115 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
1116 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07);
1117#endif // BSLSTL_MAP_VARIADIC_LIMIT_C >= 7
1118
1119#if BSLSTL_MAP_VARIADIC_LIMIT_C >= 8
1120 template <class Args_01,
1121 class Args_02,
1122 class Args_03,
1123 class Args_04,
1124 class Args_05,
1125 class Args_06,
1126 class Args_07,
1127 class Args_08>
1128 pair<iterator, bool> emplace(
1129 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1130 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1131 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1132 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1133 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1134 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
1135 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
1136 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08);
1137#endif // BSLSTL_MAP_VARIADIC_LIMIT_C >= 8
1138
1139#if BSLSTL_MAP_VARIADIC_LIMIT_C >= 9
1140 template <class Args_01,
1141 class Args_02,
1142 class Args_03,
1143 class Args_04,
1144 class Args_05,
1145 class Args_06,
1146 class Args_07,
1147 class Args_08,
1148 class Args_09>
1149 pair<iterator, bool> emplace(
1150 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1151 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1152 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1153 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1154 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1155 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
1156 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
1157 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
1158 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09);
1159#endif // BSLSTL_MAP_VARIADIC_LIMIT_C >= 9
1160
1161#if BSLSTL_MAP_VARIADIC_LIMIT_C >= 10
1162 template <class Args_01,
1163 class Args_02,
1164 class Args_03,
1165 class Args_04,
1166 class Args_05,
1167 class Args_06,
1168 class Args_07,
1169 class Args_08,
1170 class Args_09,
1171 class Args_10>
1172 pair<iterator, bool> emplace(
1173 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1174 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1175 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1176 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1177 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1178 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
1179 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
1180 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
1181 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09,
1182 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) args_10);
1183#endif // BSLSTL_MAP_VARIADIC_LIMIT_C >= 10
1184
1185
1186#if BSLSTL_MAP_VARIADIC_LIMIT_C >= 0
1188#endif // BSLSTL_MAP_VARIADIC_LIMIT_C >= 0
1189
1190#if BSLSTL_MAP_VARIADIC_LIMIT_C >= 1
1191 template <class Args_01>
1193 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01);
1194#endif // BSLSTL_MAP_VARIADIC_LIMIT_C >= 1
1195
1196#if BSLSTL_MAP_VARIADIC_LIMIT_C >= 2
1197 template <class Args_01,
1198 class Args_02>
1200 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1201 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02);
1202#endif // BSLSTL_MAP_VARIADIC_LIMIT_C >= 2
1203
1204#if BSLSTL_MAP_VARIADIC_LIMIT_C >= 3
1205 template <class Args_01,
1206 class Args_02,
1207 class Args_03>
1209 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1210 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1211 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03);
1212#endif // BSLSTL_MAP_VARIADIC_LIMIT_C >= 3
1213
1214#if BSLSTL_MAP_VARIADIC_LIMIT_C >= 4
1215 template <class Args_01,
1216 class Args_02,
1217 class Args_03,
1218 class Args_04>
1220 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1221 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1222 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1223 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04);
1224#endif // BSLSTL_MAP_VARIADIC_LIMIT_C >= 4
1225
1226#if BSLSTL_MAP_VARIADIC_LIMIT_C >= 5
1227 template <class Args_01,
1228 class Args_02,
1229 class Args_03,
1230 class Args_04,
1231 class Args_05>
1233 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1234 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1235 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1236 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1237 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05);
1238#endif // BSLSTL_MAP_VARIADIC_LIMIT_C >= 5
1239
1240#if BSLSTL_MAP_VARIADIC_LIMIT_C >= 6
1241 template <class Args_01,
1242 class Args_02,
1243 class Args_03,
1244 class Args_04,
1245 class Args_05,
1246 class Args_06>
1248 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1249 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1250 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1251 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1252 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1253 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06);
1254#endif // BSLSTL_MAP_VARIADIC_LIMIT_C >= 6
1255
1256#if BSLSTL_MAP_VARIADIC_LIMIT_C >= 7
1257 template <class Args_01,
1258 class Args_02,
1259 class Args_03,
1260 class Args_04,
1261 class Args_05,
1262 class Args_06,
1263 class Args_07>
1265 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1266 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1267 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1268 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1269 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1270 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
1271 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07);
1272#endif // BSLSTL_MAP_VARIADIC_LIMIT_C >= 7
1273
1274#if BSLSTL_MAP_VARIADIC_LIMIT_C >= 8
1275 template <class Args_01,
1276 class Args_02,
1277 class Args_03,
1278 class Args_04,
1279 class Args_05,
1280 class Args_06,
1281 class Args_07,
1282 class Args_08>
1284 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1285 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1286 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1287 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1288 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1289 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
1290 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
1291 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08);
1292#endif // BSLSTL_MAP_VARIADIC_LIMIT_C >= 8
1293
1294#if BSLSTL_MAP_VARIADIC_LIMIT_C >= 9
1295 template <class Args_01,
1296 class Args_02,
1297 class Args_03,
1298 class Args_04,
1299 class Args_05,
1300 class Args_06,
1301 class Args_07,
1302 class Args_08,
1303 class Args_09>
1305 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1306 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1307 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1308 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1309 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1310 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
1311 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
1312 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
1313 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09);
1314#endif // BSLSTL_MAP_VARIADIC_LIMIT_C >= 9
1315
1316#if BSLSTL_MAP_VARIADIC_LIMIT_C >= 10
1317 template <class Args_01,
1318 class Args_02,
1319 class Args_03,
1320 class Args_04,
1321 class Args_05,
1322 class Args_06,
1323 class Args_07,
1324 class Args_08,
1325 class Args_09,
1326 class Args_10>
1328 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1329 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1330 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1331 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1332 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1333 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
1334 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
1335 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
1336 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09,
1337 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) args_10);
1338#endif // BSLSTL_MAP_VARIADIC_LIMIT_C >= 10
1339
1340#else
1341// The generated code below is a workaround for the absence of perfect
1342// forwarding in some compilers.
1343 template <class... Args>
1344 pair<iterator, bool> emplace(
1345 BSLS_COMPILERFEATURES_FORWARD_REF(Args)... args);
1346
1347 template <class... Args>
1349 BSLS_COMPILERFEATURES_FORWARD_REF(Args)... args);
1350// }}} END GENERATED CODE
1351#endif
1352
1353 /// Remove from this map the `value_type` object at the specified
1354 /// `position`, and return an iterator referring to the element
1355 /// immediately following the removed element, or to the past-the-end
1356 /// position if the removed element was the last element in the sequence
1357 /// of elements maintained by this map. This method invalidates only
1358 /// iterators and references to the removed element and previously saved values of the `end()` iterator.
1359 ///
1360 /// \pre The behavior is undefined unless
1361 /// `position` refers to a `value_type` object in this map.
1362 iterator erase(const_iterator position);
1363 iterator erase(iterator position);
1364
1365 /// Remove from this map the `value_type` object whose key is equivalent
1366 /// the specified `key`, if such an entry exists, and return 1;
1367 /// otherwise, if there is no `value_type` object having an equivalent
1368 /// key, return 0 with no other effect. This method invalidates only
1369 /// iterators and references to the removed element and previously saved
1370 /// values of the `end()` iterator.
1371 size_type erase(const key_type& key);
1372 template <class t_KEY>
1373 typename enable_if<
1374 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1375 t_KEY>::value &&
1376 !is_convertible<BSLS_COMPILERFEATURES_FORWARD_REF(t_KEY),
1377 iterator>::value &&
1378 !is_convertible<BSLS_COMPILERFEATURES_FORWARD_REF(t_KEY),
1379 const_iterator>::value,
1381 {
1382 // Implemented inline due to Sun CC compilation error.
1383 iterator it = this->find(key);
1384 if (it == end()) {
1385 return 0; // RETURN
1386 }
1387 erase(it);
1388 return 1;
1389 }
1390
1391 /// Remove from this map the `value_type` objects starting at the
1392 /// specified `first` position up to, but including the specified `last`
1393 /// position, and return `last`. This method invalidates only
1394 /// iterators and references to the removed element and previously saved values of the `end()` iterator.
1395 ///
1396 /// \pre The behavior is undefined unless
1397 /// `first` and `last` either refer to elements in this map or are the
1398 /// `end` iterator, and the `first` position is at or before the `last`
1399 /// position in the ordered sequence provided by this container.
1401
1403 AllocatorTraits::is_always_equal::value &&
1404 bsl::is_nothrow_swappable<COMPARATOR>::value);
1405 // Exchange the value and comparator of this object with those of the
1406 // specified 'other' object; also exchange the allocator of this object
1407 // with that of 'other' if the (template parameter) type 'ALLOCATOR'
1408 // has the @ref propagate_on_container_swap trait, and do not modify
1409 // either allocator otherwise. This method provides the no-throw
1410 // exception-safety guarantee if and only if the (template parameter)
1411 // type 'COMPARATOR' provides a no-throw swap operation, and provides
1412 // the basic exception-safety guarantee otherwise; if an exception is
1413 // thrown, both objects are left in valid but unspecified states. This
1414 // operation has 'O[1]' complexity if either this object was created
1415 // with the same allocator as 'other' or 'ALLOCATOR' has the
1416 // @ref propagate_on_container_swap trait; otherwise, it has 'O[n + m]'
1417 // complexity, where 'n' and 'm' are the number of elements in this
1418 // object and 'other', respectively. Note that this method's support
1419 // for swapping objects created with different allocators when
1420 // 'ALLOCATOR' does not have the @ref propagate_on_container_swap trait is
1421 // a departure from the C++ Standard.
1422
1423#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
1424// {{{ BEGIN GENERATED CODE
1425// Command line: sim_cpp11_features.pl bslstl_map.h
1426#ifndef BSLSTL_MAP_VARIADIC_LIMIT
1427#define BSLSTL_MAP_VARIADIC_LIMIT 10
1428#endif
1429#ifndef BSLSTL_MAP_VARIADIC_LIMIT_D
1430#define BSLSTL_MAP_VARIADIC_LIMIT_D BSLSTL_MAP_VARIADIC_LIMIT
1431#endif
1432#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 0
1433 pair<iterator, bool> try_emplace(const KEY& key);
1434#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 0
1435
1436#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 1
1437 template <class Args_01>
1438 pair<iterator, bool> try_emplace(const KEY& key,
1439 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01);
1440#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 1
1441
1442#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 2
1443 template <class Args_01,
1444 class Args_02>
1445 pair<iterator, bool> try_emplace(const KEY& key,
1446 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1447 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02);
1448#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 2
1449
1450#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 3
1451 template <class Args_01,
1452 class Args_02,
1453 class Args_03>
1454 pair<iterator, bool> try_emplace(const KEY& key,
1455 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1456 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1457 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03);
1458#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 3
1459
1460#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 4
1461 template <class Args_01,
1462 class Args_02,
1463 class Args_03,
1464 class Args_04>
1465 pair<iterator, bool> try_emplace(const KEY& key,
1466 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1467 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1468 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1469 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04);
1470#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 4
1471
1472#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 5
1473 template <class Args_01,
1474 class Args_02,
1475 class Args_03,
1476 class Args_04,
1477 class Args_05>
1478 pair<iterator, bool> try_emplace(const KEY& key,
1479 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1480 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1481 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1482 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1483 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05);
1484#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 5
1485
1486#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 6
1487 template <class Args_01,
1488 class Args_02,
1489 class Args_03,
1490 class Args_04,
1491 class Args_05,
1492 class Args_06>
1493 pair<iterator, bool> try_emplace(const KEY& key,
1494 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1495 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1496 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1497 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1498 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1499 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06);
1500#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 6
1501
1502#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 7
1503 template <class Args_01,
1504 class Args_02,
1505 class Args_03,
1506 class Args_04,
1507 class Args_05,
1508 class Args_06,
1509 class Args_07>
1510 pair<iterator, bool> try_emplace(const KEY& key,
1511 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1512 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1513 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1514 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1515 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1516 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
1517 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07);
1518#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 7
1519
1520#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 8
1521 template <class Args_01,
1522 class Args_02,
1523 class Args_03,
1524 class Args_04,
1525 class Args_05,
1526 class Args_06,
1527 class Args_07,
1528 class Args_08>
1529 pair<iterator, bool> try_emplace(const KEY& key,
1530 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1531 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1532 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1533 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1534 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1535 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
1536 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
1537 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08);
1538#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 8
1539
1540#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 9
1541 template <class Args_01,
1542 class Args_02,
1543 class Args_03,
1544 class Args_04,
1545 class Args_05,
1546 class Args_06,
1547 class Args_07,
1548 class Args_08,
1549 class Args_09>
1550 pair<iterator, bool> try_emplace(const KEY& key,
1551 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1552 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1553 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1554 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1555 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1556 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
1557 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
1558 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
1559 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09);
1560#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 9
1561
1562#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 10
1563 template <class Args_01,
1564 class Args_02,
1565 class Args_03,
1566 class Args_04,
1567 class Args_05,
1568 class Args_06,
1569 class Args_07,
1570 class Args_08,
1571 class Args_09,
1572 class Args_10>
1573 pair<iterator, bool> try_emplace(const KEY& key,
1574 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1575 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1576 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1577 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1578 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1579 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
1580 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
1581 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
1582 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09,
1583 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) args_10);
1584#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 10
1585
1586#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 0
1587 pair<iterator, bool> try_emplace(BloombergLP::bslmf::MovableRef<KEY> key);
1588#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 0
1589
1590#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 1
1591 template <class Args_01>
1592 pair<iterator, bool> try_emplace(BloombergLP::bslmf::MovableRef<KEY> key,
1593 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01);
1594#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 1
1595
1596#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 2
1597 template <class Args_01,
1598 class Args_02>
1599 pair<iterator, bool> try_emplace(BloombergLP::bslmf::MovableRef<KEY> key,
1600 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1601 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02);
1602#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 2
1603
1604#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 3
1605 template <class Args_01,
1606 class Args_02,
1607 class Args_03>
1608 pair<iterator, bool> try_emplace(BloombergLP::bslmf::MovableRef<KEY> key,
1609 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1610 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1611 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03);
1612#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 3
1613
1614#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 4
1615 template <class Args_01,
1616 class Args_02,
1617 class Args_03,
1618 class Args_04>
1619 pair<iterator, bool> try_emplace(BloombergLP::bslmf::MovableRef<KEY> key,
1620 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1621 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1622 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1623 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04);
1624#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 4
1625
1626#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 5
1627 template <class Args_01,
1628 class Args_02,
1629 class Args_03,
1630 class Args_04,
1631 class Args_05>
1632 pair<iterator, bool> try_emplace(BloombergLP::bslmf::MovableRef<KEY> key,
1633 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1634 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1635 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1636 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1637 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05);
1638#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 5
1639
1640#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 6
1641 template <class Args_01,
1642 class Args_02,
1643 class Args_03,
1644 class Args_04,
1645 class Args_05,
1646 class Args_06>
1647 pair<iterator, bool> try_emplace(BloombergLP::bslmf::MovableRef<KEY> key,
1648 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1649 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1650 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1651 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1652 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1653 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06);
1654#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 6
1655
1656#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 7
1657 template <class Args_01,
1658 class Args_02,
1659 class Args_03,
1660 class Args_04,
1661 class Args_05,
1662 class Args_06,
1663 class Args_07>
1664 pair<iterator, bool> try_emplace(BloombergLP::bslmf::MovableRef<KEY> key,
1665 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1666 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1667 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1668 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1669 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1670 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
1671 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07);
1672#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 7
1673
1674#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 8
1675 template <class Args_01,
1676 class Args_02,
1677 class Args_03,
1678 class Args_04,
1679 class Args_05,
1680 class Args_06,
1681 class Args_07,
1682 class Args_08>
1683 pair<iterator, bool> try_emplace(BloombergLP::bslmf::MovableRef<KEY> key,
1684 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1685 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1686 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1687 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1688 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1689 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
1690 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
1691 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08);
1692#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 8
1693
1694#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 9
1695 template <class Args_01,
1696 class Args_02,
1697 class Args_03,
1698 class Args_04,
1699 class Args_05,
1700 class Args_06,
1701 class Args_07,
1702 class Args_08,
1703 class Args_09>
1704 pair<iterator, bool> try_emplace(BloombergLP::bslmf::MovableRef<KEY> key,
1705 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1706 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1707 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1708 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1709 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1710 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
1711 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
1712 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
1713 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09);
1714#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 9
1715
1716#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 10
1717 template <class Args_01,
1718 class Args_02,
1719 class Args_03,
1720 class Args_04,
1721 class Args_05,
1722 class Args_06,
1723 class Args_07,
1724 class Args_08,
1725 class Args_09,
1726 class Args_10>
1727 pair<iterator, bool> try_emplace(BloombergLP::bslmf::MovableRef<KEY> key,
1728 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1729 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1730 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1731 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1732 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1733 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
1734 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
1735 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
1736 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09,
1737 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) args_10);
1738#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 10
1739
1740#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 0
1741 template<class LOOKUP_KEY>
1742 typename bsl::enable_if<
1743 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1744 LOOKUP_KEY>::value &&
1746 const_iterator>::value &&
1748 iterator>::value,
1749 pair<iterator, bool> >::type
1751 {
1752
1753 const LOOKUP_KEY& lvalue = key;
1754
1755 int comparisonResult;
1756 BloombergLP::bslalg::RbTreeNode *insertLocation =
1757 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
1758 &comparisonResult,
1759 &d_tree,
1760 this->comparator(),
1761 lvalue);
1762 if (!comparisonResult) {
1763 return pair<iterator, bool>(
1764 iterator(insertLocation), false);
1765 }
1766
1767 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
1768 BloombergLP::bslalg::RbTreeNode *node =
1769 nodeFactory().emplaceIntoNewNode(
1770 std::piecewise_construct,
1771 std::forward_as_tuple(
1773 key)),
1774 std::forward_as_tuple());
1775 #else
1776 BloombergLP::bslalg::RbTreeNode *node =
1777 nodeFactory().emplaceIntoNewNode(
1778 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key),
1779 mapped_type());
1780 #endif
1781
1782 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
1783 insertLocation,
1784 comparisonResult < 0,
1785 node);
1786
1787 return pair<iterator, bool>(iterator(node), true);
1788 }
1789#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 0
1790
1791#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 1
1792 template<class LOOKUP_KEY, class Args_01>
1793 typename bsl::enable_if<
1794 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1795 LOOKUP_KEY>::value &&
1797 const_iterator>::value &&
1799 iterator>::value,
1800 pair<iterator, bool> >::type
1802 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01)
1803 {
1804
1805 const LOOKUP_KEY& lvalue = key;
1806
1807 int comparisonResult;
1808 BloombergLP::bslalg::RbTreeNode *insertLocation =
1809 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
1810 &comparisonResult,
1811 &d_tree,
1812 this->comparator(),
1813 lvalue);
1814 if (!comparisonResult) {
1815 return pair<iterator, bool>(
1816 iterator(insertLocation), false);
1817 }
1818
1819 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
1820 BloombergLP::bslalg::RbTreeNode *node =
1821 nodeFactory().emplaceIntoNewNode(
1822 std::piecewise_construct,
1823 std::forward_as_tuple(
1825 key)),
1826 std::forward_as_tuple(
1828 args_01)));
1829 #else
1830 BloombergLP::bslalg::RbTreeNode *node =
1831 nodeFactory().emplaceIntoNewNode(
1832 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key),
1834 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01)));
1835 #endif
1836
1837 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
1838 insertLocation,
1839 comparisonResult < 0,
1840 node);
1841
1842 return pair<iterator, bool>(iterator(node), true);
1843 }
1844#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 1
1845
1846#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 2
1847 template<class LOOKUP_KEY, class Args_01,
1848 class Args_02>
1849 typename bsl::enable_if<
1850 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1851 LOOKUP_KEY>::value &&
1853 const_iterator>::value &&
1855 iterator>::value,
1856 pair<iterator, bool> >::type
1858 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1859 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02)
1860 {
1861
1862 const LOOKUP_KEY& lvalue = key;
1863
1864 int comparisonResult;
1865 BloombergLP::bslalg::RbTreeNode *insertLocation =
1866 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
1867 &comparisonResult,
1868 &d_tree,
1869 this->comparator(),
1870 lvalue);
1871 if (!comparisonResult) {
1872 return pair<iterator, bool>(
1873 iterator(insertLocation), false);
1874 }
1875
1876 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
1877 BloombergLP::bslalg::RbTreeNode *node =
1878 nodeFactory().emplaceIntoNewNode(
1879 std::piecewise_construct,
1880 std::forward_as_tuple(
1882 key)),
1883 std::forward_as_tuple(
1885 args_01),
1887 args_02)));
1888 #else
1889 BloombergLP::bslalg::RbTreeNode *node =
1890 nodeFactory().emplaceIntoNewNode(
1891 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key),
1893 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
1894 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02)));
1895 #endif
1896
1897 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
1898 insertLocation,
1899 comparisonResult < 0,
1900 node);
1901
1902 return pair<iterator, bool>(iterator(node), true);
1903 }
1904#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 2
1905
1906#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 3
1907 template<class LOOKUP_KEY, class Args_01,
1908 class Args_02,
1909 class Args_03>
1910 typename bsl::enable_if<
1911 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1912 LOOKUP_KEY>::value &&
1914 const_iterator>::value &&
1916 iterator>::value,
1917 pair<iterator, bool> >::type
1919 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1920 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1921 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03)
1922 {
1923
1924 const LOOKUP_KEY& lvalue = key;
1925
1926 int comparisonResult;
1927 BloombergLP::bslalg::RbTreeNode *insertLocation =
1928 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
1929 &comparisonResult,
1930 &d_tree,
1931 this->comparator(),
1932 lvalue);
1933 if (!comparisonResult) {
1934 return pair<iterator, bool>(
1935 iterator(insertLocation), false);
1936 }
1937
1938 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
1939 BloombergLP::bslalg::RbTreeNode *node =
1940 nodeFactory().emplaceIntoNewNode(
1941 std::piecewise_construct,
1942 std::forward_as_tuple(
1944 key)),
1945 std::forward_as_tuple(
1947 args_01),
1949 args_02),
1951 args_03)));
1952 #else
1953 BloombergLP::bslalg::RbTreeNode *node =
1954 nodeFactory().emplaceIntoNewNode(
1955 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key),
1957 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
1958 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
1959 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03)));
1960 #endif
1961
1962 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
1963 insertLocation,
1964 comparisonResult < 0,
1965 node);
1966
1967 return pair<iterator, bool>(iterator(node), true);
1968 }
1969#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 3
1970
1971#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 4
1972 template<class LOOKUP_KEY, class Args_01,
1973 class Args_02,
1974 class Args_03,
1975 class Args_04>
1976 typename bsl::enable_if<
1977 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
1978 LOOKUP_KEY>::value &&
1980 const_iterator>::value &&
1982 iterator>::value,
1983 pair<iterator, bool> >::type
1985 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1986 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1987 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1988 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04)
1989 {
1990
1991 const LOOKUP_KEY& lvalue = key;
1992
1993 int comparisonResult;
1994 BloombergLP::bslalg::RbTreeNode *insertLocation =
1995 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
1996 &comparisonResult,
1997 &d_tree,
1998 this->comparator(),
1999 lvalue);
2000 if (!comparisonResult) {
2001 return pair<iterator, bool>(
2002 iterator(insertLocation), false);
2003 }
2004
2005 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
2006 BloombergLP::bslalg::RbTreeNode *node =
2007 nodeFactory().emplaceIntoNewNode(
2008 std::piecewise_construct,
2009 std::forward_as_tuple(
2011 key)),
2012 std::forward_as_tuple(
2014 args_01),
2016 args_02),
2018 args_03),
2020 args_04)));
2021 #else
2022 BloombergLP::bslalg::RbTreeNode *node =
2023 nodeFactory().emplaceIntoNewNode(
2024 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key),
2026 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
2027 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
2028 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
2029 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04)));
2030 #endif
2031
2032 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2033 insertLocation,
2034 comparisonResult < 0,
2035 node);
2036
2037 return pair<iterator, bool>(iterator(node), true);
2038 }
2039#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 4
2040
2041#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 5
2042 template<class LOOKUP_KEY, class Args_01,
2043 class Args_02,
2044 class Args_03,
2045 class Args_04,
2046 class Args_05>
2047 typename bsl::enable_if<
2048 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
2049 LOOKUP_KEY>::value &&
2051 const_iterator>::value &&
2053 iterator>::value,
2054 pair<iterator, bool> >::type
2056 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
2057 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
2058 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
2059 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
2060 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05)
2061 {
2062
2063 const LOOKUP_KEY& lvalue = key;
2064
2065 int comparisonResult;
2066 BloombergLP::bslalg::RbTreeNode *insertLocation =
2067 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
2068 &comparisonResult,
2069 &d_tree,
2070 this->comparator(),
2071 lvalue);
2072 if (!comparisonResult) {
2073 return pair<iterator, bool>(
2074 iterator(insertLocation), false);
2075 }
2076
2077 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
2078 BloombergLP::bslalg::RbTreeNode *node =
2079 nodeFactory().emplaceIntoNewNode(
2080 std::piecewise_construct,
2081 std::forward_as_tuple(
2083 key)),
2084 std::forward_as_tuple(
2086 args_01),
2088 args_02),
2090 args_03),
2092 args_04),
2094 args_05)));
2095 #else
2096 BloombergLP::bslalg::RbTreeNode *node =
2097 nodeFactory().emplaceIntoNewNode(
2098 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key),
2100 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
2101 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
2102 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
2103 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
2104 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05)));
2105 #endif
2106
2107 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2108 insertLocation,
2109 comparisonResult < 0,
2110 node);
2111
2112 return pair<iterator, bool>(iterator(node), true);
2113 }
2114#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 5
2115
2116#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 6
2117 template<class LOOKUP_KEY, class Args_01,
2118 class Args_02,
2119 class Args_03,
2120 class Args_04,
2121 class Args_05,
2122 class Args_06>
2123 typename bsl::enable_if<
2124 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
2125 LOOKUP_KEY>::value &&
2127 const_iterator>::value &&
2129 iterator>::value,
2130 pair<iterator, bool> >::type
2132 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
2133 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
2134 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
2135 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
2136 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
2137 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06)
2138 {
2139
2140 const LOOKUP_KEY& lvalue = key;
2141
2142 int comparisonResult;
2143 BloombergLP::bslalg::RbTreeNode *insertLocation =
2144 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
2145 &comparisonResult,
2146 &d_tree,
2147 this->comparator(),
2148 lvalue);
2149 if (!comparisonResult) {
2150 return pair<iterator, bool>(
2151 iterator(insertLocation), false);
2152 }
2153
2154 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
2155 BloombergLP::bslalg::RbTreeNode *node =
2156 nodeFactory().emplaceIntoNewNode(
2157 std::piecewise_construct,
2158 std::forward_as_tuple(
2160 key)),
2161 std::forward_as_tuple(
2163 args_01),
2165 args_02),
2167 args_03),
2169 args_04),
2171 args_05),
2173 args_06)));
2174 #else
2175 BloombergLP::bslalg::RbTreeNode *node =
2176 nodeFactory().emplaceIntoNewNode(
2177 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key),
2179 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
2180 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
2181 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
2182 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
2183 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
2184 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06)));
2185 #endif
2186
2187 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2188 insertLocation,
2189 comparisonResult < 0,
2190 node);
2191
2192 return pair<iterator, bool>(iterator(node), true);
2193 }
2194#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 6
2195
2196#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 7
2197 template<class LOOKUP_KEY, class Args_01,
2198 class Args_02,
2199 class Args_03,
2200 class Args_04,
2201 class Args_05,
2202 class Args_06,
2203 class Args_07>
2204 typename bsl::enable_if<
2205 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
2206 LOOKUP_KEY>::value &&
2208 const_iterator>::value &&
2210 iterator>::value,
2211 pair<iterator, bool> >::type
2213 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
2214 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
2215 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
2216 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
2217 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
2218 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
2219 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07)
2220 {
2221
2222 const LOOKUP_KEY& lvalue = key;
2223
2224 int comparisonResult;
2225 BloombergLP::bslalg::RbTreeNode *insertLocation =
2226 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
2227 &comparisonResult,
2228 &d_tree,
2229 this->comparator(),
2230 lvalue);
2231 if (!comparisonResult) {
2232 return pair<iterator, bool>(
2233 iterator(insertLocation), false);
2234 }
2235
2236 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
2237 BloombergLP::bslalg::RbTreeNode *node =
2238 nodeFactory().emplaceIntoNewNode(
2239 std::piecewise_construct,
2240 std::forward_as_tuple(
2242 key)),
2243 std::forward_as_tuple(
2245 args_01),
2247 args_02),
2249 args_03),
2251 args_04),
2253 args_05),
2255 args_06),
2257 args_07)));
2258 #else
2259 BloombergLP::bslalg::RbTreeNode *node =
2260 nodeFactory().emplaceIntoNewNode(
2261 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key),
2263 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
2264 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
2265 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
2266 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
2267 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
2268 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
2269 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07)));
2270 #endif
2271
2272 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2273 insertLocation,
2274 comparisonResult < 0,
2275 node);
2276
2277 return pair<iterator, bool>(iterator(node), true);
2278 }
2279#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 7
2280
2281#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 8
2282 template<class LOOKUP_KEY, class Args_01,
2283 class Args_02,
2284 class Args_03,
2285 class Args_04,
2286 class Args_05,
2287 class Args_06,
2288 class Args_07,
2289 class Args_08>
2290 typename bsl::enable_if<
2291 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
2292 LOOKUP_KEY>::value &&
2294 const_iterator>::value &&
2296 iterator>::value,
2297 pair<iterator, bool> >::type
2299 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
2300 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
2301 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
2302 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
2303 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
2304 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
2305 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
2306 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08)
2307 {
2308
2309 const LOOKUP_KEY& lvalue = key;
2310
2311 int comparisonResult;
2312 BloombergLP::bslalg::RbTreeNode *insertLocation =
2313 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
2314 &comparisonResult,
2315 &d_tree,
2316 this->comparator(),
2317 lvalue);
2318 if (!comparisonResult) {
2319 return pair<iterator, bool>(
2320 iterator(insertLocation), false);
2321 }
2322
2323 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
2324 BloombergLP::bslalg::RbTreeNode *node =
2325 nodeFactory().emplaceIntoNewNode(
2326 std::piecewise_construct,
2327 std::forward_as_tuple(
2329 key)),
2330 std::forward_as_tuple(
2332 args_01),
2334 args_02),
2336 args_03),
2338 args_04),
2340 args_05),
2342 args_06),
2344 args_07),
2346 args_08)));
2347 #else
2348 BloombergLP::bslalg::RbTreeNode *node =
2349 nodeFactory().emplaceIntoNewNode(
2350 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key),
2352 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
2353 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
2354 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
2355 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
2356 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
2357 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
2358 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
2359 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08)));
2360 #endif
2361
2362 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2363 insertLocation,
2364 comparisonResult < 0,
2365 node);
2366
2367 return pair<iterator, bool>(iterator(node), true);
2368 }
2369#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 8
2370
2371#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 9
2372 template<class LOOKUP_KEY, class Args_01,
2373 class Args_02,
2374 class Args_03,
2375 class Args_04,
2376 class Args_05,
2377 class Args_06,
2378 class Args_07,
2379 class Args_08,
2380 class Args_09>
2381 typename bsl::enable_if<
2382 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
2383 LOOKUP_KEY>::value &&
2385 const_iterator>::value &&
2387 iterator>::value,
2388 pair<iterator, bool> >::type
2390 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
2391 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
2392 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
2393 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
2394 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
2395 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
2396 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
2397 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
2398 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09)
2399 {
2400
2401 const LOOKUP_KEY& lvalue = key;
2402
2403 int comparisonResult;
2404 BloombergLP::bslalg::RbTreeNode *insertLocation =
2405 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
2406 &comparisonResult,
2407 &d_tree,
2408 this->comparator(),
2409 lvalue);
2410 if (!comparisonResult) {
2411 return pair<iterator, bool>(
2412 iterator(insertLocation), false);
2413 }
2414
2415 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
2416 BloombergLP::bslalg::RbTreeNode *node =
2417 nodeFactory().emplaceIntoNewNode(
2418 std::piecewise_construct,
2419 std::forward_as_tuple(
2421 key)),
2422 std::forward_as_tuple(
2424 args_01),
2426 args_02),
2428 args_03),
2430 args_04),
2432 args_05),
2434 args_06),
2436 args_07),
2438 args_08),
2440 args_09)));
2441 #else
2442 BloombergLP::bslalg::RbTreeNode *node =
2443 nodeFactory().emplaceIntoNewNode(
2444 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key),
2446 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
2447 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
2448 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
2449 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
2450 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
2451 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
2452 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
2453 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08),
2454 BSLS_COMPILERFEATURES_FORWARD(Args_09, args_09)));
2455 #endif
2456
2457 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2458 insertLocation,
2459 comparisonResult < 0,
2460 node);
2461
2462 return pair<iterator, bool>(iterator(node), true);
2463 }
2464#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 9
2465
2466#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 10
2467 template<class LOOKUP_KEY, class Args_01,
2468 class Args_02,
2469 class Args_03,
2470 class Args_04,
2471 class Args_05,
2472 class Args_06,
2473 class Args_07,
2474 class Args_08,
2475 class Args_09,
2476 class Args_10>
2477 typename bsl::enable_if<
2478 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
2479 LOOKUP_KEY>::value &&
2481 const_iterator>::value &&
2483 iterator>::value,
2484 pair<iterator, bool> >::type
2486 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
2487 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
2488 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
2489 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
2490 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
2491 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
2492 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
2493 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
2494 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09,
2495 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) args_10)
2496 {
2497
2498 const LOOKUP_KEY& lvalue = key;
2499
2500 int comparisonResult;
2501 BloombergLP::bslalg::RbTreeNode *insertLocation =
2502 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
2503 &comparisonResult,
2504 &d_tree,
2505 this->comparator(),
2506 lvalue);
2507 if (!comparisonResult) {
2508 return pair<iterator, bool>(
2509 iterator(insertLocation), false);
2510 }
2511
2512 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
2513 BloombergLP::bslalg::RbTreeNode *node =
2514 nodeFactory().emplaceIntoNewNode(
2515 std::piecewise_construct,
2516 std::forward_as_tuple(
2518 key)),
2519 std::forward_as_tuple(
2521 args_01),
2523 args_02),
2525 args_03),
2527 args_04),
2529 args_05),
2531 args_06),
2533 args_07),
2535 args_08),
2537 args_09),
2539 args_10)));
2540 #else
2541 BloombergLP::bslalg::RbTreeNode *node =
2542 nodeFactory().emplaceIntoNewNode(
2543 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key),
2545 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
2546 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
2547 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
2548 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
2549 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
2550 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
2551 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
2552 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08),
2553 BSLS_COMPILERFEATURES_FORWARD(Args_09, args_09),
2554 BSLS_COMPILERFEATURES_FORWARD(Args_10, args_10)));
2555 #endif
2556
2557 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2558 insertLocation,
2559 comparisonResult < 0,
2560 node);
2561
2562 return pair<iterator, bool>(iterator(node), true);
2563 }
2564#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 10
2565
2566
2567#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 0
2568 iterator try_emplace(const_iterator hint, const KEY& key);
2569#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 0
2570
2571#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 1
2572 template<class Args_01>
2573 iterator try_emplace(const_iterator hint, const KEY& key,
2574 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01);
2575#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 1
2576
2577#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 2
2578 template<class Args_01,
2579 class Args_02>
2580 iterator try_emplace(const_iterator hint, const KEY& key,
2581 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
2582 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02);
2583#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 2
2584
2585#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 3
2586 template<class Args_01,
2587 class Args_02,
2588 class Args_03>
2589 iterator try_emplace(const_iterator hint, const KEY& key,
2590 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
2591 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
2592 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03);
2593#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 3
2594
2595#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 4
2596 template<class Args_01,
2597 class Args_02,
2598 class Args_03,
2599 class Args_04>
2600 iterator try_emplace(const_iterator hint, const KEY& key,
2601 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
2602 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
2603 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
2604 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04);
2605#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 4
2606
2607#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 5
2608 template<class Args_01,
2609 class Args_02,
2610 class Args_03,
2611 class Args_04,
2612 class Args_05>
2613 iterator try_emplace(const_iterator hint, const KEY& key,
2614 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
2615 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
2616 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
2617 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
2618 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05);
2619#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 5
2620
2621#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 6
2622 template<class Args_01,
2623 class Args_02,
2624 class Args_03,
2625 class Args_04,
2626 class Args_05,
2627 class Args_06>
2628 iterator try_emplace(const_iterator hint, const KEY& key,
2629 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
2630 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
2631 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
2632 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
2633 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
2634 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06);
2635#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 6
2636
2637#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 7
2638 template<class Args_01,
2639 class Args_02,
2640 class Args_03,
2641 class Args_04,
2642 class Args_05,
2643 class Args_06,
2644 class Args_07>
2645 iterator try_emplace(const_iterator hint, const KEY& key,
2646 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
2647 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
2648 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
2649 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
2650 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
2651 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
2652 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07);
2653#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 7
2654
2655#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 8
2656 template<class Args_01,
2657 class Args_02,
2658 class Args_03,
2659 class Args_04,
2660 class Args_05,
2661 class Args_06,
2662 class Args_07,
2663 class Args_08>
2664 iterator try_emplace(const_iterator hint, const KEY& key,
2665 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
2666 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
2667 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
2668 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
2669 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
2670 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
2671 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
2672 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08);
2673#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 8
2674
2675#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 9
2676 template<class Args_01,
2677 class Args_02,
2678 class Args_03,
2679 class Args_04,
2680 class Args_05,
2681 class Args_06,
2682 class Args_07,
2683 class Args_08,
2684 class Args_09>
2685 iterator try_emplace(const_iterator hint, const KEY& key,
2686 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
2687 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
2688 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
2689 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
2690 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
2691 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
2692 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
2693 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
2694 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09);
2695#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 9
2696
2697#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 10
2698 template<class Args_01,
2699 class Args_02,
2700 class Args_03,
2701 class Args_04,
2702 class Args_05,
2703 class Args_06,
2704 class Args_07,
2705 class Args_08,
2706 class Args_09,
2707 class Args_10>
2708 iterator try_emplace(const_iterator hint, const KEY& key,
2709 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
2710 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
2711 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
2712 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
2713 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
2714 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
2715 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
2716 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
2717 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09,
2718 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) args_10);
2719#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 10
2720
2721#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 0
2723 BloombergLP::bslmf::MovableRef<KEY> key);
2724#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 0
2725
2726#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 1
2727 template <class Args_01>
2729 BloombergLP::bslmf::MovableRef<KEY> key,
2730 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01);
2731#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 1
2732
2733#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 2
2734 template <class Args_01,
2735 class Args_02>
2737 BloombergLP::bslmf::MovableRef<KEY> key,
2738 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
2739 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02);
2740#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 2
2741
2742#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 3
2743 template <class Args_01,
2744 class Args_02,
2745 class Args_03>
2747 BloombergLP::bslmf::MovableRef<KEY> key,
2748 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
2749 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
2750 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03);
2751#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 3
2752
2753#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 4
2754 template <class Args_01,
2755 class Args_02,
2756 class Args_03,
2757 class Args_04>
2759 BloombergLP::bslmf::MovableRef<KEY> key,
2760 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
2761 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
2762 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
2763 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04);
2764#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 4
2765
2766#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 5
2767 template <class Args_01,
2768 class Args_02,
2769 class Args_03,
2770 class Args_04,
2771 class Args_05>
2773 BloombergLP::bslmf::MovableRef<KEY> key,
2774 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
2775 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
2776 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
2777 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
2778 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05);
2779#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 5
2780
2781#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 6
2782 template <class Args_01,
2783 class Args_02,
2784 class Args_03,
2785 class Args_04,
2786 class Args_05,
2787 class Args_06>
2789 BloombergLP::bslmf::MovableRef<KEY> key,
2790 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
2791 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
2792 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
2793 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
2794 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
2795 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06);
2796#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 6
2797
2798#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 7
2799 template <class Args_01,
2800 class Args_02,
2801 class Args_03,
2802 class Args_04,
2803 class Args_05,
2804 class Args_06,
2805 class Args_07>
2807 BloombergLP::bslmf::MovableRef<KEY> key,
2808 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
2809 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
2810 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
2811 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
2812 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
2813 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
2814 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07);
2815#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 7
2816
2817#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 8
2818 template <class Args_01,
2819 class Args_02,
2820 class Args_03,
2821 class Args_04,
2822 class Args_05,
2823 class Args_06,
2824 class Args_07,
2825 class Args_08>
2827 BloombergLP::bslmf::MovableRef<KEY> key,
2828 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
2829 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
2830 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
2831 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
2832 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
2833 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
2834 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
2835 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08);
2836#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 8
2837
2838#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 9
2839 template <class Args_01,
2840 class Args_02,
2841 class Args_03,
2842 class Args_04,
2843 class Args_05,
2844 class Args_06,
2845 class Args_07,
2846 class Args_08,
2847 class Args_09>
2849 BloombergLP::bslmf::MovableRef<KEY> key,
2850 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
2851 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
2852 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
2853 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
2854 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
2855 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
2856 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
2857 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
2858 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09);
2859#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 9
2860
2861#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 10
2862 template <class Args_01,
2863 class Args_02,
2864 class Args_03,
2865 class Args_04,
2866 class Args_05,
2867 class Args_06,
2868 class Args_07,
2869 class Args_08,
2870 class Args_09,
2871 class Args_10>
2873 BloombergLP::bslmf::MovableRef<KEY> key,
2874 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
2875 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
2876 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
2877 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
2878 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
2879 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
2880 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
2881 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
2882 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09,
2883 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) args_10);
2884#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 10
2885
2886#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 0
2887 template<class LOOKUP_KEY>
2888 typename bsl::enable_if<
2889 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
2890 LOOKUP_KEY>::value,
2891 iterator>::type
2893 BSLS_COMPILERFEATURES_FORWARD_REF(LOOKUP_KEY) key)
2894 {
2895
2896 const LOOKUP_KEY& lvalue = key;
2897
2898 BloombergLP::bslalg::RbTreeNode *hintNode =
2899 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
2900
2901 int comparisonResult;
2902 BloombergLP::bslalg::RbTreeNode *insertLocation =
2903 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
2904 &comparisonResult,
2905 &d_tree,
2906 this->comparator(),
2907 lvalue,
2908 hintNode);
2909
2910 if (!comparisonResult) {
2911 return iterator(insertLocation);
2912 }
2913
2914 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
2915 BloombergLP::bslalg::RbTreeNode *node =
2916 nodeFactory().emplaceIntoNewNode(
2917 std::piecewise_construct,
2918 std::forward_as_tuple(
2920 key)),
2921 std::forward_as_tuple());
2922 #else
2923 BloombergLP::bslalg::RbTreeNode *node =
2924 nodeFactory().emplaceIntoNewNode(
2925 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key),
2926 mapped_type());
2927 #endif
2928
2929 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2930 insertLocation,
2931 comparisonResult < 0,
2932 node);
2933
2934 return iterator(node);
2935 }
2936#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 0
2937
2938#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 1
2939 template<class LOOKUP_KEY, class Args_01>
2940 typename bsl::enable_if<
2941 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
2942 LOOKUP_KEY>::value,
2943 iterator>::type
2945 BSLS_COMPILERFEATURES_FORWARD_REF(LOOKUP_KEY) key,
2946 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01)
2947 {
2948
2949 const LOOKUP_KEY& lvalue = key;
2950
2951 BloombergLP::bslalg::RbTreeNode *hintNode =
2952 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
2953
2954 int comparisonResult;
2955 BloombergLP::bslalg::RbTreeNode *insertLocation =
2956 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
2957 &comparisonResult,
2958 &d_tree,
2959 this->comparator(),
2960 lvalue,
2961 hintNode);
2962
2963 if (!comparisonResult) {
2964 return iterator(insertLocation);
2965 }
2966
2967 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
2968 BloombergLP::bslalg::RbTreeNode *node =
2969 nodeFactory().emplaceIntoNewNode(
2970 std::piecewise_construct,
2971 std::forward_as_tuple(
2973 key)),
2974 std::forward_as_tuple(
2976 args_01)));
2977 #else
2978 BloombergLP::bslalg::RbTreeNode *node =
2979 nodeFactory().emplaceIntoNewNode(
2980 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key),
2982 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01)));
2983 #endif
2984
2985 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
2986 insertLocation,
2987 comparisonResult < 0,
2988 node);
2989
2990 return iterator(node);
2991 }
2992#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 1
2993
2994#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 2
2995 template<class LOOKUP_KEY, class Args_01,
2996 class Args_02>
2997 typename bsl::enable_if<
2998 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
2999 LOOKUP_KEY>::value,
3000 iterator>::type
3002 BSLS_COMPILERFEATURES_FORWARD_REF(LOOKUP_KEY) key,
3003 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
3004 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02)
3005 {
3006
3007 const LOOKUP_KEY& lvalue = key;
3008
3009 BloombergLP::bslalg::RbTreeNode *hintNode =
3010 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
3011
3012 int comparisonResult;
3013 BloombergLP::bslalg::RbTreeNode *insertLocation =
3014 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3015 &comparisonResult,
3016 &d_tree,
3017 this->comparator(),
3018 lvalue,
3019 hintNode);
3020
3021 if (!comparisonResult) {
3022 return iterator(insertLocation);
3023 }
3024
3025 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
3026 BloombergLP::bslalg::RbTreeNode *node =
3027 nodeFactory().emplaceIntoNewNode(
3028 std::piecewise_construct,
3029 std::forward_as_tuple(
3031 key)),
3032 std::forward_as_tuple(
3034 args_01),
3036 args_02)));
3037 #else
3038 BloombergLP::bslalg::RbTreeNode *node =
3039 nodeFactory().emplaceIntoNewNode(
3040 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key),
3042 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
3043 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02)));
3044 #endif
3045
3046 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3047 insertLocation,
3048 comparisonResult < 0,
3049 node);
3050
3051 return iterator(node);
3052 }
3053#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 2
3054
3055#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 3
3056 template<class LOOKUP_KEY, class Args_01,
3057 class Args_02,
3058 class Args_03>
3059 typename bsl::enable_if<
3060 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
3061 LOOKUP_KEY>::value,
3062 iterator>::type
3064 BSLS_COMPILERFEATURES_FORWARD_REF(LOOKUP_KEY) key,
3065 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
3066 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
3067 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03)
3068 {
3069
3070 const LOOKUP_KEY& lvalue = key;
3071
3072 BloombergLP::bslalg::RbTreeNode *hintNode =
3073 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
3074
3075 int comparisonResult;
3076 BloombergLP::bslalg::RbTreeNode *insertLocation =
3077 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3078 &comparisonResult,
3079 &d_tree,
3080 this->comparator(),
3081 lvalue,
3082 hintNode);
3083
3084 if (!comparisonResult) {
3085 return iterator(insertLocation);
3086 }
3087
3088 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
3089 BloombergLP::bslalg::RbTreeNode *node =
3090 nodeFactory().emplaceIntoNewNode(
3091 std::piecewise_construct,
3092 std::forward_as_tuple(
3094 key)),
3095 std::forward_as_tuple(
3097 args_01),
3099 args_02),
3101 args_03)));
3102 #else
3103 BloombergLP::bslalg::RbTreeNode *node =
3104 nodeFactory().emplaceIntoNewNode(
3105 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key),
3107 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
3108 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
3109 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03)));
3110 #endif
3111
3112 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3113 insertLocation,
3114 comparisonResult < 0,
3115 node);
3116
3117 return iterator(node);
3118 }
3119#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 3
3120
3121#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 4
3122 template<class LOOKUP_KEY, class Args_01,
3123 class Args_02,
3124 class Args_03,
3125 class Args_04>
3126 typename bsl::enable_if<
3127 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
3128 LOOKUP_KEY>::value,
3129 iterator>::type
3131 BSLS_COMPILERFEATURES_FORWARD_REF(LOOKUP_KEY) key,
3132 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
3133 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
3134 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
3135 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04)
3136 {
3137
3138 const LOOKUP_KEY& lvalue = key;
3139
3140 BloombergLP::bslalg::RbTreeNode *hintNode =
3141 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
3142
3143 int comparisonResult;
3144 BloombergLP::bslalg::RbTreeNode *insertLocation =
3145 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3146 &comparisonResult,
3147 &d_tree,
3148 this->comparator(),
3149 lvalue,
3150 hintNode);
3151
3152 if (!comparisonResult) {
3153 return iterator(insertLocation);
3154 }
3155
3156 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
3157 BloombergLP::bslalg::RbTreeNode *node =
3158 nodeFactory().emplaceIntoNewNode(
3159 std::piecewise_construct,
3160 std::forward_as_tuple(
3162 key)),
3163 std::forward_as_tuple(
3165 args_01),
3167 args_02),
3169 args_03),
3171 args_04)));
3172 #else
3173 BloombergLP::bslalg::RbTreeNode *node =
3174 nodeFactory().emplaceIntoNewNode(
3175 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key),
3177 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
3178 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
3179 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
3180 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04)));
3181 #endif
3182
3183 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3184 insertLocation,
3185 comparisonResult < 0,
3186 node);
3187
3188 return iterator(node);
3189 }
3190#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 4
3191
3192#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 5
3193 template<class LOOKUP_KEY, class Args_01,
3194 class Args_02,
3195 class Args_03,
3196 class Args_04,
3197 class Args_05>
3198 typename bsl::enable_if<
3199 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
3200 LOOKUP_KEY>::value,
3201 iterator>::type
3203 BSLS_COMPILERFEATURES_FORWARD_REF(LOOKUP_KEY) key,
3204 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
3205 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
3206 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
3207 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
3208 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05)
3209 {
3210
3211 const LOOKUP_KEY& lvalue = key;
3212
3213 BloombergLP::bslalg::RbTreeNode *hintNode =
3214 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
3215
3216 int comparisonResult;
3217 BloombergLP::bslalg::RbTreeNode *insertLocation =
3218 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3219 &comparisonResult,
3220 &d_tree,
3221 this->comparator(),
3222 lvalue,
3223 hintNode);
3224
3225 if (!comparisonResult) {
3226 return iterator(insertLocation);
3227 }
3228
3229 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
3230 BloombergLP::bslalg::RbTreeNode *node =
3231 nodeFactory().emplaceIntoNewNode(
3232 std::piecewise_construct,
3233 std::forward_as_tuple(
3235 key)),
3236 std::forward_as_tuple(
3238 args_01),
3240 args_02),
3242 args_03),
3244 args_04),
3246 args_05)));
3247 #else
3248 BloombergLP::bslalg::RbTreeNode *node =
3249 nodeFactory().emplaceIntoNewNode(
3250 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key),
3252 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
3253 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
3254 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
3255 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
3256 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05)));
3257 #endif
3258
3259 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3260 insertLocation,
3261 comparisonResult < 0,
3262 node);
3263
3264 return iterator(node);
3265 }
3266#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 5
3267
3268#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 6
3269 template<class LOOKUP_KEY, class Args_01,
3270 class Args_02,
3271 class Args_03,
3272 class Args_04,
3273 class Args_05,
3274 class Args_06>
3275 typename bsl::enable_if<
3276 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
3277 LOOKUP_KEY>::value,
3278 iterator>::type
3280 BSLS_COMPILERFEATURES_FORWARD_REF(LOOKUP_KEY) key,
3281 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
3282 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
3283 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
3284 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
3285 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
3286 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06)
3287 {
3288
3289 const LOOKUP_KEY& lvalue = key;
3290
3291 BloombergLP::bslalg::RbTreeNode *hintNode =
3292 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
3293
3294 int comparisonResult;
3295 BloombergLP::bslalg::RbTreeNode *insertLocation =
3296 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3297 &comparisonResult,
3298 &d_tree,
3299 this->comparator(),
3300 lvalue,
3301 hintNode);
3302
3303 if (!comparisonResult) {
3304 return iterator(insertLocation);
3305 }
3306
3307 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
3308 BloombergLP::bslalg::RbTreeNode *node =
3309 nodeFactory().emplaceIntoNewNode(
3310 std::piecewise_construct,
3311 std::forward_as_tuple(
3313 key)),
3314 std::forward_as_tuple(
3316 args_01),
3318 args_02),
3320 args_03),
3322 args_04),
3324 args_05),
3326 args_06)));
3327 #else
3328 BloombergLP::bslalg::RbTreeNode *node =
3329 nodeFactory().emplaceIntoNewNode(
3330 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key),
3332 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
3333 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
3334 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
3335 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
3336 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
3337 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06)));
3338 #endif
3339
3340 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3341 insertLocation,
3342 comparisonResult < 0,
3343 node);
3344
3345 return iterator(node);
3346 }
3347#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 6
3348
3349#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 7
3350 template<class LOOKUP_KEY, class Args_01,
3351 class Args_02,
3352 class Args_03,
3353 class Args_04,
3354 class Args_05,
3355 class Args_06,
3356 class Args_07>
3357 typename bsl::enable_if<
3358 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
3359 LOOKUP_KEY>::value,
3360 iterator>::type
3362 BSLS_COMPILERFEATURES_FORWARD_REF(LOOKUP_KEY) key,
3363 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
3364 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
3365 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
3366 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
3367 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
3368 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
3369 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07)
3370 {
3371
3372 const LOOKUP_KEY& lvalue = key;
3373
3374 BloombergLP::bslalg::RbTreeNode *hintNode =
3375 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
3376
3377 int comparisonResult;
3378 BloombergLP::bslalg::RbTreeNode *insertLocation =
3379 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3380 &comparisonResult,
3381 &d_tree,
3382 this->comparator(),
3383 lvalue,
3384 hintNode);
3385
3386 if (!comparisonResult) {
3387 return iterator(insertLocation);
3388 }
3389
3390 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
3391 BloombergLP::bslalg::RbTreeNode *node =
3392 nodeFactory().emplaceIntoNewNode(
3393 std::piecewise_construct,
3394 std::forward_as_tuple(
3396 key)),
3397 std::forward_as_tuple(
3399 args_01),
3401 args_02),
3403 args_03),
3405 args_04),
3407 args_05),
3409 args_06),
3411 args_07)));
3412 #else
3413 BloombergLP::bslalg::RbTreeNode *node =
3414 nodeFactory().emplaceIntoNewNode(
3415 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key),
3417 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
3418 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
3419 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
3420 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
3421 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
3422 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
3423 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07)));
3424 #endif
3425
3426 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3427 insertLocation,
3428 comparisonResult < 0,
3429 node);
3430
3431 return iterator(node);
3432 }
3433#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 7
3434
3435#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 8
3436 template<class LOOKUP_KEY, class Args_01,
3437 class Args_02,
3438 class Args_03,
3439 class Args_04,
3440 class Args_05,
3441 class Args_06,
3442 class Args_07,
3443 class Args_08>
3444 typename bsl::enable_if<
3445 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
3446 LOOKUP_KEY>::value,
3447 iterator>::type
3449 BSLS_COMPILERFEATURES_FORWARD_REF(LOOKUP_KEY) key,
3450 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
3451 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
3452 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
3453 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
3454 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
3455 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
3456 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
3457 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08)
3458 {
3459
3460 const LOOKUP_KEY& lvalue = key;
3461
3462 BloombergLP::bslalg::RbTreeNode *hintNode =
3463 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
3464
3465 int comparisonResult;
3466 BloombergLP::bslalg::RbTreeNode *insertLocation =
3467 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3468 &comparisonResult,
3469 &d_tree,
3470 this->comparator(),
3471 lvalue,
3472 hintNode);
3473
3474 if (!comparisonResult) {
3475 return iterator(insertLocation);
3476 }
3477
3478 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
3479 BloombergLP::bslalg::RbTreeNode *node =
3480 nodeFactory().emplaceIntoNewNode(
3481 std::piecewise_construct,
3482 std::forward_as_tuple(
3484 key)),
3485 std::forward_as_tuple(
3487 args_01),
3489 args_02),
3491 args_03),
3493 args_04),
3495 args_05),
3497 args_06),
3499 args_07),
3501 args_08)));
3502 #else
3503 BloombergLP::bslalg::RbTreeNode *node =
3504 nodeFactory().emplaceIntoNewNode(
3505 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key),
3507 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
3508 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
3509 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
3510 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
3511 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
3512 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
3513 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
3514 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08)));
3515 #endif
3516
3517 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3518 insertLocation,
3519 comparisonResult < 0,
3520 node);
3521
3522 return iterator(node);
3523 }
3524#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 8
3525
3526#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 9
3527 template<class LOOKUP_KEY, class Args_01,
3528 class Args_02,
3529 class Args_03,
3530 class Args_04,
3531 class Args_05,
3532 class Args_06,
3533 class Args_07,
3534 class Args_08,
3535 class Args_09>
3536 typename bsl::enable_if<
3537 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
3538 LOOKUP_KEY>::value,
3539 iterator>::type
3541 BSLS_COMPILERFEATURES_FORWARD_REF(LOOKUP_KEY) key,
3542 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
3543 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
3544 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
3545 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
3546 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
3547 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
3548 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
3549 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
3550 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09)
3551 {
3552
3553 const LOOKUP_KEY& lvalue = key;
3554
3555 BloombergLP::bslalg::RbTreeNode *hintNode =
3556 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
3557
3558 int comparisonResult;
3559 BloombergLP::bslalg::RbTreeNode *insertLocation =
3560 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3561 &comparisonResult,
3562 &d_tree,
3563 this->comparator(),
3564 lvalue,
3565 hintNode);
3566
3567 if (!comparisonResult) {
3568 return iterator(insertLocation);
3569 }
3570
3571 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
3572 BloombergLP::bslalg::RbTreeNode *node =
3573 nodeFactory().emplaceIntoNewNode(
3574 std::piecewise_construct,
3575 std::forward_as_tuple(
3577 key)),
3578 std::forward_as_tuple(
3580 args_01),
3582 args_02),
3584 args_03),
3586 args_04),
3588 args_05),
3590 args_06),
3592 args_07),
3594 args_08),
3596 args_09)));
3597 #else
3598 BloombergLP::bslalg::RbTreeNode *node =
3599 nodeFactory().emplaceIntoNewNode(
3600 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key),
3602 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
3603 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
3604 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
3605 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
3606 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
3607 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
3608 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
3609 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08),
3610 BSLS_COMPILERFEATURES_FORWARD(Args_09, args_09)));
3611 #endif
3612
3613 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3614 insertLocation,
3615 comparisonResult < 0,
3616 node);
3617
3618 return iterator(node);
3619 }
3620#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 9
3621
3622#if BSLSTL_MAP_VARIADIC_LIMIT_D >= 10
3623 template<class LOOKUP_KEY, class Args_01,
3624 class Args_02,
3625 class Args_03,
3626 class Args_04,
3627 class Args_05,
3628 class Args_06,
3629 class Args_07,
3630 class Args_08,
3631 class Args_09,
3632 class Args_10>
3633 typename bsl::enable_if<
3634 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
3635 LOOKUP_KEY>::value,
3636 iterator>::type
3638 BSLS_COMPILERFEATURES_FORWARD_REF(LOOKUP_KEY) key,
3639 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
3640 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
3641 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
3642 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
3643 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
3644 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
3645 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
3646 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
3647 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09,
3648 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) args_10)
3649 {
3650
3651 const LOOKUP_KEY& lvalue = key;
3652
3653 BloombergLP::bslalg::RbTreeNode *hintNode =
3654 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
3655
3656 int comparisonResult;
3657 BloombergLP::bslalg::RbTreeNode *insertLocation =
3658 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3659 &comparisonResult,
3660 &d_tree,
3661 this->comparator(),
3662 lvalue,
3663 hintNode);
3664
3665 if (!comparisonResult) {
3666 return iterator(insertLocation);
3667 }
3668
3669 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
3670 BloombergLP::bslalg::RbTreeNode *node =
3671 nodeFactory().emplaceIntoNewNode(
3672 std::piecewise_construct,
3673 std::forward_as_tuple(
3675 key)),
3676 std::forward_as_tuple(
3678 args_01),
3680 args_02),
3682 args_03),
3684 args_04),
3686 args_05),
3688 args_06),
3690 args_07),
3692 args_08),
3694 args_09),
3696 args_10)));
3697 #else
3698 BloombergLP::bslalg::RbTreeNode *node =
3699 nodeFactory().emplaceIntoNewNode(
3700 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key),
3702 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
3703 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
3704 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
3705 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
3706 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
3707 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
3708 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
3709 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08),
3710 BSLS_COMPILERFEATURES_FORWARD(Args_09, args_09),
3711 BSLS_COMPILERFEATURES_FORWARD(Args_10, args_10)));
3712 #endif
3713
3714 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3715 insertLocation,
3716 comparisonResult < 0,
3717 node);
3718
3719 return iterator(node);
3720 }
3721#endif // BSLSTL_MAP_VARIADIC_LIMIT_D >= 10
3722
3723#else
3724// The generated code below is a workaround for the absence of perfect
3725// forwarding in some compilers.
3726 template <class... Args>
3727 pair<iterator, bool> try_emplace(const KEY& key,
3728 BSLS_COMPILERFEATURES_FORWARD_REF(Args)... args);
3729 template <class... Args>
3730 pair<iterator, bool> try_emplace(BloombergLP::bslmf::MovableRef<KEY> key,
3731 BSLS_COMPILERFEATURES_FORWARD_REF(Args)... args);
3732 template<class LOOKUP_KEY, class... Args>
3733 typename bsl::enable_if<
3734 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
3735 LOOKUP_KEY>::value &&
3737 const_iterator>::value &&
3739 iterator>::value,
3740 pair<iterator, bool> >::type
3743 {
3744
3745 const LOOKUP_KEY& lvalue = key;
3746
3747 int comparisonResult;
3748 BloombergLP::bslalg::RbTreeNode *insertLocation =
3749 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3750 &comparisonResult,
3751 &d_tree,
3752 this->comparator(),
3753 lvalue);
3754 if (!comparisonResult) {
3755 return pair<iterator, bool>(
3756 iterator(insertLocation), false);
3757 }
3758
3759 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
3760 BloombergLP::bslalg::RbTreeNode *node =
3761 nodeFactory().emplaceIntoNewNode(
3762 std::piecewise_construct,
3763 std::forward_as_tuple(
3765 key)),
3766 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(Args,
3767 args)...));
3768 #else
3769 BloombergLP::bslalg::RbTreeNode *node =
3770 nodeFactory().emplaceIntoNewNode(
3771 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key),
3773 #endif
3774
3775 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3776 insertLocation,
3777 comparisonResult < 0,
3778 node);
3779
3780 return pair<iterator, bool>(iterator(node), true);
3781 }
3782
3783 template<class... Args>
3784 iterator try_emplace(const_iterator hint, const KEY& key,
3785 BSLS_COMPILERFEATURES_FORWARD_REF(Args)... args);
3786 template <class... Args>
3788 BloombergLP::bslmf::MovableRef<KEY> key,
3789 BSLS_COMPILERFEATURES_FORWARD_REF(Args)... args);
3790 template<class LOOKUP_KEY, class... Args>
3791 typename bsl::enable_if<
3792 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
3793 LOOKUP_KEY>::value,
3794 iterator>::type
3796 BSLS_COMPILERFEATURES_FORWARD_REF(LOOKUP_KEY) key,
3798 {
3799
3800 const LOOKUP_KEY& lvalue = key;
3801
3802 BloombergLP::bslalg::RbTreeNode *hintNode =
3803 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
3804
3805 int comparisonResult;
3806 BloombergLP::bslalg::RbTreeNode *insertLocation =
3807 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
3808 &comparisonResult,
3809 &d_tree,
3810 this->comparator(),
3811 lvalue,
3812 hintNode);
3813
3814 if (!comparisonResult) {
3815 return iterator(insertLocation);
3816 }
3817
3818 #if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
3819 BloombergLP::bslalg::RbTreeNode *node =
3820 nodeFactory().emplaceIntoNewNode(
3821 std::piecewise_construct,
3822 std::forward_as_tuple(
3824 key)),
3825 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(Args,
3826 args)...));
3827 #else
3828 BloombergLP::bslalg::RbTreeNode *node =
3829 nodeFactory().emplaceIntoNewNode(
3830 BSLS_COMPILERFEATURES_FORWARD(LOOKUP_KEY, key),
3832 #endif
3833
3834 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
3835 insertLocation,
3836 comparisonResult < 0,
3837 node);
3838
3839 return iterator(node);
3840 }
3841// }}} END GENERATED CODE
3842#endif
3843
3844 /// Remove all entries from this map.
3845 /// \note Note that the map is empty after
3846 /// this call, but allocated memory may be retained for future use.
3848
3849 // Turn off complaints about necessarily class-defined methods.
3850 // BDE_VERIFY pragma: push
3851 // BDE_VERIFY pragma: -CD01
3852
3853 /// Return an iterator providing modifiable access to the `value_type`
3854 /// object in this map whose key is equivalent to the specified `key`,
3855 /// if such an entry exists, and the past-the-end (`end`) iterator
3856 /// otherwise.
3857 iterator find(const key_type& key)
3858 {
3859 // Note: implemented inline due to Sun CC compilation error.
3860
3861 return iterator(BloombergLP::bslalg::RbTreeUtil::find(
3862 d_tree, this->comparator(), key));
3863 }
3864
3865 /// Return an iterator providing modifiable access to the `value_type`
3866 /// object in this map whose key is equivalent to the specified `key`,
3867 /// if such an entry exists, and the past-the-end (`end`) iterator
3868 /// otherwise.
3869 template <class LOOKUP_KEY>
3870 typename bsl::enable_if<
3871 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
3872 LOOKUP_KEY>::value,
3873 iterator>::type
3874 find(const LOOKUP_KEY& key)
3875 {
3876 // Note: implemented inline due to Sun CC compilation error.
3877
3878 return iterator(BloombergLP::bslalg::RbTreeUtil::find(
3879 d_tree, this->comparator(), key));
3880 }
3881
3882 /// Return an iterator providing modifiable access to the first (i.e.,
3883 /// ordered least) `value_type` object in this map whose key is
3884 /// greater-than or equal-to the specified `key`, and the past-the-end
3885 /// iterator if this map does not contain a `value_type` object whose key is greater-than or equal-to `key`.
3886 ///
3887 /// \note Note that this function
3888 /// returns the *first* position before which a `value_type` object
3889 /// having an equivalent key could be inserted into the ordered sequence
3890 /// maintained by this map, while preserving its ordering.
3891 iterator lower_bound(const key_type& key)
3892 {
3893 // Note: implemented inline due to Sun CC compilation error.
3894
3895 return iterator(BloombergLP::bslalg::RbTreeUtil::lowerBound(
3896 d_tree, this->comparator(), key));
3897 }
3898
3899 /// Return an iterator providing modifiable access to the first (i.e.,
3900 /// ordered least) `value_type` object in this map whose key is
3901 /// greater-than or equal-to the specified `key`, and the past-the-end
3902 /// iterator if this map does not contain a `value_type` object whose key is greater-than or equal-to `key`.
3903 ///
3904 /// \note Note that this function
3905 /// returns the *first* position before which a `value_type` object
3906 /// having an equivalent key could be inserted into the ordered sequence
3907 /// maintained by this map, while preserving its ordering.
3908 template <class LOOKUP_KEY>
3909 typename bsl::enable_if<
3910 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
3911 LOOKUP_KEY>::value,
3912 iterator>::type
3913 lower_bound(const LOOKUP_KEY& key)
3914 {
3915 // Note: implemented inline due to Sun CC compilation error.
3916
3917 return iterator(BloombergLP::bslalg::RbTreeUtil::lowerBound(
3918 d_tree, this->comparator(), key));
3919 }
3920
3921 /// Return an iterator providing modifiable access to the first (i.e.,
3922 /// ordered least) `value_type` object in this map whose key is greater
3923 /// than the specified `key`, and the past-the-end iterator if this map
3924 /// does not contain a `value_type` object whose key is greater-than `key`.
3925 ///
3926 /// \note Note that this function returns the *last* position before
3927 /// which a `value_type` object having an equivalent key could be
3928 /// inserted into the ordered sequence maintained by this map, while
3929 /// preserving its ordering.
3930 iterator upper_bound(const key_type& key)
3931 {
3932 // Note: implemented inline due to Sun CC compilation error.
3933
3934 return iterator(BloombergLP::bslalg::RbTreeUtil::upperBound(
3935 d_tree, this->comparator(), key));
3936 }
3937
3938 /// Return an iterator providing modifiable access to the first (i.e.,
3939 /// ordered least) `value_type` object in this map whose key is greater
3940 /// than the specified `key`, and the past-the-end iterator if this map
3941 /// does not contain a `value_type` object whose key is greater-than `key`.
3942 ///
3943 /// \note Note that this function returns the *last* position before
3944 /// which a `value_type` object having an equivalent key could be
3945 /// inserted into the ordered sequence maintained by this map, while
3946 /// preserving its ordering.
3947 template <class LOOKUP_KEY>
3948 typename bsl::enable_if<
3949 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
3950 LOOKUP_KEY>::value,
3951 iterator>::type
3952 upper_bound(const LOOKUP_KEY& key)
3953 {
3954 // Note: implemented inline due to Sun CC compilation error.
3955
3956 return iterator(BloombergLP::bslalg::RbTreeUtil::upperBound(
3957 d_tree, this->comparator(), key));
3958 }
3959
3960 /// Return a pair of iterators providing modifiable access to the
3961 /// sequence of `value_type` objects in this map whose keys are
3962 /// equivalent to the specified `key`, where the first iterator is
3963 /// positioned at the start of the sequence and the second is positioned
3964 /// one past the end of the sequence. The first returned iterator will
3965 /// be `lower_bound(key)`, the second returned iterator will be
3966 /// `upper_bound(key)`, and, if this map contains no `value_type`
3967 /// objects with an equivalent key, then the two returned iterators will have the same value.
3968 ///
3969 /// \note Note that since a map maintains unique keys,
3970 /// the range will contain at most one element.
3971 pair<iterator, iterator> equal_range(const key_type& key)
3972 {
3973 // Note: implemented inline due to Sun CC compilation error.
3974
3975 iterator startIt = lower_bound(key);
3976 iterator endIt = startIt;
3977 if (endIt != end() && !comparator()(key, *endIt.node())) {
3978 ++endIt;
3979 }
3980 return pair<iterator, iterator>(startIt, endIt);
3981 }
3982
3983 /// Return a pair of iterators providing modifiable access to the
3984 /// sequence of `value_type` objects in this map whose keys are
3985 /// equivalent to the specified `key`, where the first iterator is
3986 /// positioned at the start of the sequence and the second is positioned
3987 /// one past the end of the sequence. The first returned iterator will
3988 /// be `lower_bound(key)`, the second returned iterator will be
3989 /// `upper_bound(key)`, and, if this map contains no `value_type`
3990 /// objects with an equivalent key, then the two returned iterators will have the same value.
3991 ///
3992 /// \note Note that although a map maintains unique
3993 /// keys, the range may contain more than one element, because a
3994 /// transparent comparator may have been supplied that provides a
3995 /// different (but compatible) partitioning of keys for `LOOKUP_KEY` as
3996 /// the comparisons used to order the keys in the map.
3997 template <class LOOKUP_KEY>
3998 typename bsl::enable_if<
3999 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
4000 LOOKUP_KEY>::value,
4001 pair<iterator, iterator> >::type
4002 equal_range(const LOOKUP_KEY& key)
4003 {
4004 // Note: implemented inline due to Sun CC compilation error.
4005
4006 iterator startIt = lower_bound(key);
4007 iterator endIt = startIt;
4008 if (endIt != end() && !comparator()(key, *endIt.node())) {
4009 ++endIt;
4010
4011 // Typically, even with a transparent comparator, we expect to find
4012 // either 0 or 1 matching keys. We test for those two common cases
4013 // before performing a logarithmic search via @ref upper_bound to
4014 // determine the end of the range.
4015
4016 if (endIt != end() && !comparator()(key, *endIt.node())) {
4017 endIt = upper_bound(key);
4018 }
4019 }
4020 return pair<iterator, iterator>(startIt, endIt);
4021 }
4022
4023 // BDE_VERIFY pragma: pop
4024
4025 // ACCESSORS
4026
4027 /// Return (a copy of) the allocator used for memory allocation by this
4028 /// map.
4030
4031 /// Return an iterator providing non-modifiable access to the first
4032 /// `value_type` object in the ordered sequence of `value_type` objects
4033 /// maintained by this map, or the `end` iterator if this map is empty.
4035
4036 /// Return an iterator providing non-modifiable access to the
4037 /// past-the-end element in the ordered sequence of `value_type`
4038 /// objects maintained by this map.
4040
4041 /// Return a reverse iterator providing non-modifiable access to the
4042 /// last `value_type` object in the ordered sequence of `value_type`
4043 /// objects maintained by this map, or `rend` if this map is empty.
4045
4046 /// Return a reverse iterator providing non-modifiable access to the
4047 /// prior-to-the-beginning element in the ordered sequence of
4048 /// `value_type` objects maintained by this map.
4050
4051 /// Return an iterator providing non-modifiable access to the first
4052 /// `value_type` object in the ordered sequence of `value_type` objects
4053 /// maintained by this map, or the `cend` iterator if this map is empty.
4055
4056 /// Return an iterator providing non-modifiable access to the
4057 /// past-the-end element in the ordered sequence of `value_type` objects
4058 /// maintained by this map.
4060
4061 /// Return a reverse iterator providing non-modifiable access to the
4062 /// last `value_type` object in the ordered sequence of `value_type`
4063 /// objects maintained by this map, or `crend` if this map is empty.
4065
4066 /// Return a reverse iterator providing non-modifiable access to the
4067 /// prior-to-the-beginning element in the ordered sequence of
4068 /// `value_type` objects maintained by this map.
4070
4071 /// Return `true` if this map contains an element whose key is
4072 /// equivalent to the specified `key`.
4073 bool contains(const key_type &key) const;
4074
4075 /// Return `true` if this map contains an element whose key is
4076 /// equivalent to the specified `key`.
4077 template <class LOOKUP_KEY>
4078 typename bsl::enable_if<
4079 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
4080 LOOKUP_KEY>::value,
4081 bool>::type
4082 contains(const LOOKUP_KEY& key) const
4083 {
4084 // Note: implemented inline due to Sun CC compilation error.
4085
4086 return find(key) != end();
4087 }
4088
4089 /// Return `true` if this map contains no elements, and `false`
4090 /// otherwise.
4091 bool empty() const BSLS_KEYWORD_NOEXCEPT;
4092
4093 /// Return the number of elements in this map.
4095
4096 /// Return a theoretical upper bound on the largest number of elements that this map could possibly hold.
4097 ///
4098 /// \note Note that there is no guarantee
4099 /// that the map can successfully grow to the returned size, or even
4100 /// close to that size without running out of resources.
4102
4103 /// Return a reference providing non-modifiable access to the
4104 /// mapped-value associated with a key that is equivalent to the
4105 /// specified `key`, if such an entry exists; otherwise, throw a `std::out_of_range` exception.
4106 ///
4107 /// \note Note that this method may also throw
4108 /// a different kind of exception if the (user-supplied) comparator
4109 /// throws.
4110 typename add_lvalue_reference<const VALUE>::type at(const key_type& key)
4111 const;
4112
4113 /// Return a reference providing non-modifiable access to the
4114 /// mapped-value associated with a key that is equivalent to the
4115 /// specified `key`, if such an entry exists; otherwise, throw a `std::out_of_range` exception.
4116 ///
4117 /// \note Note that this method may also throw
4118 /// a different kind of exception if the (user-supplied) comparator
4119 /// throws.
4120 template <class LOOKUP_KEY>
4121 typename bsl::enable_if<
4122 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
4123 LOOKUP_KEY>::value,
4124 typename add_lvalue_reference<const VALUE>::type>::type
4125 at(const LOOKUP_KEY& key) const {
4126 // Note: implemented inline due to Sun CC compilation error.
4127
4128 const_iterator iter = find(key);
4129 if (iter == end()) {
4130 BloombergLP::bslstl::StdExceptUtil::throwOutOfRange(
4131 "map<...>::at(LOOKUP_KEY) const: invalid key value");
4132 }
4133 return iter->second;
4134 }
4135
4136 /// Return the key-comparison functor (or function pointer) used by this
4137 /// map; if a comparator was supplied at construction, return its value;
4138 /// otherwise, return a default constructed @ref key_compare object.
4139 ///
4140 /// \note Note that this comparator compares objects of type `KEY`, which is the
4141 /// key part of the `value_type` objects contained in this map.
4142 key_compare key_comp() const;
4143
4144 /// Return a functor for comparing two `value_type` objects by comparing their respective keys using `key_comp()`.
4145 ///
4146 /// \note Note that this
4147 /// comparator compares objects of type `value_type` (i.e.,
4148 /// `bsl::pair<const KEY, VALUE>`).
4149 value_compare value_comp() const;
4150
4151 // Turn off complaints about necessarily class-defined methods.
4152 // BDE_VERIFY pragma: push
4153 // BDE_VERIFY pragma: -CD01
4154
4155 /// Return an iterator providing non-modifiable access to the
4156 /// `value_type` object in this map whose key is equivalent to the
4157 /// specified `key`, if such an entry exists, and the past-the-end
4158 /// (`end`) iterator otherwise.
4159 const_iterator find(const key_type& key) const
4160 {
4161 // Note: implemented inline due to Sun CC compilation error.
4162
4163 return const_iterator(BloombergLP::bslalg::RbTreeUtil::find(
4164 d_tree, this->comparator(), key));
4165 }
4166
4167 /// Return an iterator providing non-modifiable access to the
4168 /// `value_type` object in this map whose key is equivalent to the
4169 /// specified `key`, if such an entry exists, and the past-the-end
4170 /// (`end`) iterator otherwise.
4171 template <class LOOKUP_KEY>
4172 typename bsl::enable_if<
4173 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
4174 LOOKUP_KEY>::value,
4175 const_iterator>::type
4176 find(const LOOKUP_KEY& key) const
4177 {
4178 // Note: implemented inline due to Sun CC compilation error.
4179
4180 return const_iterator(BloombergLP::bslalg::RbTreeUtil::find(
4181 d_tree, this->comparator(), key));
4182 }
4183
4184 /// Return the number of `value_type` objects within this map whose keys are equivalent to the specified `key`.
4185 ///
4186 /// \note Note that since a map
4187 /// maintains unique keys, the returned value will be either 0 or 1.
4188 size_type count(const key_type& key) const
4189 {
4190 // Note: implemented inline due to Sun CC compilation error.
4191
4192 return (find(key) != end()) ? 1 : 0;
4193 }
4194
4195 /// Return the number of `value_type` objects within this map whose keys are equivalent to the specified `key`.
4196 ///
4197 /// \note Note that although a map
4198 /// maintains unique keys, the returned value can be other than 0 or 1,
4199 /// because a transparent comparator may have been supplied that
4200 /// provides a different (but compatible) partitioning of keys for
4201 /// `LOOKUP_KEY` as the comparisons used to order the keys in the map.
4202 template <class LOOKUP_KEY>
4203 typename bsl::enable_if<
4204 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
4205 LOOKUP_KEY>::value,
4206 size_type>::type
4207 count(const LOOKUP_KEY& key) const
4208 {
4209 // Note: implemented inline due to Sun CC compilation error.
4210
4211 int count = 0;
4212 const_iterator it = lower_bound(key);
4213
4214 while (it != end() && !comparator()(key, *it.node())) {
4215 ++it;
4216 ++count;
4217 }
4218 return count;
4219 }
4220
4221 /// Return an iterator providing non-modifiable access to the first
4222 /// (i.e., ordered least) `value_type` object in this map whose key is
4223 /// greater-than or equal-to the specified `key`, and the past-the-end
4224 /// iterator if this map does not contain a `value_type` object whose key is greater-than or equal-to `key`.
4225 ///
4226 /// \note Note that this function
4227 /// returns the *first* position before which a `value_type` object
4228 /// having an equivalent key could be inserted into the ordered sequence
4229 /// maintained by this map, while preserving its ordering.
4230 const_iterator lower_bound(const key_type& key) const
4231 {
4232 // Note: implemented inline due to Sun CC compilation error.
4233
4234 return iterator(BloombergLP::bslalg::RbTreeUtil::lowerBound(
4235 d_tree, this->comparator(), key));
4236 }
4237
4238 /// Return an iterator providing non-modifiable access to the first
4239 /// (i.e., ordered least) `value_type` object in this map whose key is
4240 /// greater-than or equal-to the specified `key`, and the past-the-end
4241 /// iterator if this map does not contain a `value_type` object whose key is greater-than or equal-to `key`.
4242 ///
4243 /// \note Note that this function
4244 /// returns the *first* position before which a `value_type` object
4245 /// having an equivalent key could be inserted into the ordered sequence
4246 /// maintained by this map, while preserving its ordering.
4247 template <class LOOKUP_KEY>
4248 typename bsl::enable_if<
4249 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
4250 LOOKUP_KEY>::value,
4251 const_iterator>::type
4252 lower_bound(const LOOKUP_KEY& key) const
4253 {
4254 // Note: implemented inline due to Sun CC compilation error.
4255
4256 return const_iterator(
4257 BloombergLP::bslalg::RbTreeUtil::lowerBound(d_tree,
4258 this->comparator(),
4259 key));
4260 }
4261
4262 /// Return an iterator providing non-modifiable access to the first
4263 /// (i.e., ordered least) `value_type` object in this map whose key is
4264 /// greater than the specified `key`, and the past-the-end iterator if
4265 /// this map does not contain a `value_type` object whose key is greater-than `key`.
4266 ///
4267 /// \note Note that this function returns the *last*
4268 /// position before which a `value_type` object having an equivalent key
4269 /// could be inserted into the ordered sequence maintained by this map,
4270 /// while preserving its ordering.
4271 const_iterator upper_bound(const key_type& key) const
4272 {
4273 // Note: implemented inline due to Sun CC compilation error.
4274
4275 return const_iterator(BloombergLP::bslalg::RbTreeUtil::upperBound(
4276 d_tree, this->comparator(), key));
4277 }
4278
4279 /// Return an iterator providing non-modifiable access to the first
4280 /// (i.e., ordered least) `value_type` object in this map whose key is
4281 /// greater than the specified `key`, and the past-the-end iterator if
4282 /// this map does not contain a `value_type` object whose key is greater-than `key`.
4283 ///
4284 /// \note Note that this function returns the *last*
4285 /// position before which a `value_type` object having an equivalent key
4286 /// could be inserted into the ordered sequence maintained by this map,
4287 /// while preserving its ordering.
4288 template <class LOOKUP_KEY>
4289 typename bsl::enable_if<
4290 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
4291 LOOKUP_KEY>::value,
4292 const_iterator>::type
4293 upper_bound(const LOOKUP_KEY& key) const
4294 {
4295 // Note: implemented inline due to Sun CC compilation error.
4296
4297 return const_iterator(BloombergLP::bslalg::RbTreeUtil::upperBound(
4298 d_tree, this->comparator(), key));
4299 }
4300
4301 /// Return a pair of iterators providing non-modifiable access to the
4302 /// sequence of `value_type` objects in this map whose keys are
4303 /// equivalent to the specified `key`, where the first iterator is
4304 /// positioned at the start of the sequence and the second iterator is
4305 /// positioned one past the end of the sequence. The first returned
4306 /// iterator will be `lower_bound(key)`, the second returned iterator
4307 /// will be `upper_bound(key)`, and, if this map contains no
4308 /// `value_type` objects having keys equivalent to `key`, then the two returned iterators will have the same value.
4309 ///
4310 /// \note Note that since a map
4311 /// maintains unique keys, the range will contain at most one element.
4312 pair<const_iterator, const_iterator> equal_range(const key_type& key) const
4313 {
4314 // Note: implemented inline due to Sun CC compilation error.
4315
4316 const_iterator startIt = lower_bound(key);
4317 const_iterator endIt = startIt;
4318 if (endIt != end() && !comparator()(key, *endIt.node())) {
4319 ++endIt;
4320 }
4321 return pair<const_iterator, const_iterator>(startIt, endIt);
4322 }
4323
4324 /// Return a pair of iterators providing non-modifiable access to the
4325 /// sequence of `value_type` objects in this map whose keys are
4326 /// equivalent to the specified `key`, where the first iterator is
4327 /// positioned at the start of the sequence and the second iterator is
4328 /// positioned one past the end of the sequence. The first returned
4329 /// iterator will be `lower_bound(key)`, the second returned iterator
4330 /// will be `upper_bound(key)`, and, if this map contains no
4331 /// `value_type` objects having keys equivalent to `key`, then the two returned iterators will have the same value.
4332 ///
4333 /// \note Note that although a
4334 /// map maintains unique keys, the range may contain more than one
4335 /// element, because a transparent comparator may have been supplied
4336 /// that provides a different (but compatible) partitioning of keys for
4337 /// `LOOKUP_KEY` as the comparisons used to order the keys in the map.
4338 template <class LOOKUP_KEY>
4339 typename bsl::enable_if<
4340 BloombergLP::bslmf::IsTransparentPredicate<COMPARATOR,
4341 LOOKUP_KEY>::value,
4342 pair<const_iterator, const_iterator> >::type
4343 equal_range(const LOOKUP_KEY& key) const
4344 {
4345 // Note: implemented inline due to Sun CC compilation error.
4346
4347 const_iterator startIt = lower_bound(key);
4348 const_iterator endIt = startIt;
4349 if (endIt != end() && !comparator()(key, *endIt.node())) {
4350 ++endIt;
4351
4352 // Typically, even with a transparent comparator, we expect to find
4353 // either 0 or 1 matching keys. We test for those two common cases
4354 // before performing a logarithmic search via @ref upper_bound to
4355 // determine the end of the range.
4356
4357 if (endIt != end() && !comparator()(key, *endIt.node())) {
4358 endIt = upper_bound(key);
4359 }
4360 }
4361 return pair<const_iterator, const_iterator>(startIt, endIt);
4362 }
4363
4364 // BDE_VERIFY pragma: pop
4365};
4366
4367#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
4368// CLASS TEMPLATE DEDUCTION GUIDES
4369
4370/// Deduce the template parameters `KEY` and `VALUE` from the `value_type`
4371/// of the iterators supplied to the constructor of `map`. Deduce the
4372/// template parameters `COMPARATOR` and `ALLOCATOR` from the other
4373/// parameters passed to the constructor. This deduction guide does not
4374/// participate unless the supplied allocator meets the requirements of a
4375/// standard allocator.
4376template <
4377 class INPUT_ITERATOR,
4378 class KEY = BloombergLP::bslstl::IteratorUtil::IterKey_t<INPUT_ITERATOR>,
4379 class VALUE =
4380 BloombergLP::bslstl::IteratorUtil::IterMapped_t<INPUT_ITERATOR>,
4381 class COMPARATOR = std::less<KEY>,
4382 class ALLOCATOR = bsl::allocator<
4383 BloombergLP::bslstl::IteratorUtil::IterToAlloc_t<INPUT_ITERATOR>>,
4384 class = bsl::enable_if_t<!bsl::IsStdAllocator_v<COMPARATOR>>,
4385 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
4386 >
4387map(INPUT_ITERATOR,
4388 INPUT_ITERATOR,
4389 COMPARATOR = COMPARATOR(),
4390 ALLOCATOR = ALLOCATOR())
4391-> map<KEY, VALUE, COMPARATOR, ALLOCATOR>;
4392
4393/// Deduce the template parameters `KEY` and `VALUE` from the `value_type`
4394/// of the iterators supplied to the constructor of `map`. Deduce the
4395/// template parameter `COMPARATOR` from the other parameter passed to the
4396/// constructor. This deduction guide does not participate unless the
4397/// supplied allocator is convertible to
4398/// `bsl::allocator<bsl::pair<const KEY, VALUE>>`.
4399template <
4400 class INPUT_ITERATOR,
4401 class COMPARATOR,
4402 class ALLOC,
4403 class KEY = BloombergLP::bslstl::IteratorUtil::IterKey_t<INPUT_ITERATOR>,
4404 class VALUE =
4405 BloombergLP::bslstl::IteratorUtil::IterMapped_t<INPUT_ITERATOR>,
4406 class DEFAULT_ALLOCATOR = bsl::allocator<pair<const KEY, VALUE>>,
4407 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
4408 >
4409map(INPUT_ITERATOR, INPUT_ITERATOR, COMPARATOR, ALLOC *)
4410-> map<KEY, VALUE, COMPARATOR>;
4411
4412/// Deduce the template parameters `KEY` and `VALUE` from the `value_type`
4413/// of the iterators supplied to the constructor of `map`. This deduction
4414/// guide does not participate unless the supplied allocator meets the
4415/// requirements of a standard allocator.
4416template <
4417 class INPUT_ITERATOR,
4418 class ALLOCATOR,
4419 class KEY = BloombergLP::bslstl::IteratorUtil::IterKey_t<INPUT_ITERATOR>,
4420 class VALUE =
4421 BloombergLP::bslstl::IteratorUtil::IterMapped_t<INPUT_ITERATOR>,
4422 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
4423 >
4424map(INPUT_ITERATOR, INPUT_ITERATOR, ALLOCATOR)
4425-> map<KEY, VALUE, std::less<KEY>, ALLOCATOR>;
4426
4427/// Deduce the template parameters `KEY` and `VALUE` from the `value_type`
4428/// of the iterators supplied to the constructor of `map`. This deduction
4429/// guide does not participate unless the supplied allocator is convertible
4430/// to `bsl::allocator<bsl::pair<const KEY, VALUE>>`.
4431template <
4432 class INPUT_ITERATOR,
4433 class ALLOC,
4434 class KEY = BloombergLP::bslstl::IteratorUtil::IterKey_t<INPUT_ITERATOR>,
4435 class VALUE =
4436 BloombergLP::bslstl::IteratorUtil::IterMapped_t<INPUT_ITERATOR>,
4437 class DEFAULT_ALLOCATOR = bsl::allocator<pair<const KEY, VALUE>>,
4438 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
4439 >
4440map(INPUT_ITERATOR, INPUT_ITERATOR, ALLOC *)
4441-> map<KEY, VALUE>;
4442
4443/// Deduce the template parameters `KEY` and `VALUE` from the `value_type`
4444/// of the initializer_list supplied to the constructor of `map`. Deduce
4445/// the template parameters `COMPARATOR` and `ALLOCATOR` from the other
4446/// parameters passed to the constructor. This deduction guide does not
4447/// participate unless the supplied allocator meets the requirements of a
4448/// standard allocator.
4449template <
4450 class KEY,
4451 class VALUE,
4452 class COMPARATOR = std::less<KEY>,
4453 class ALLOCATOR = bsl::allocator<bsl::pair<const KEY, VALUE>>,
4454 class = bsl::enable_if_t<!bsl::IsStdAllocator_v<COMPARATOR>>,
4455 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
4456 >
4457map(std::initializer_list<pair<const KEY, VALUE>>,
4458 COMPARATOR = COMPARATOR(),
4459 ALLOCATOR = ALLOCATOR())
4460-> map<KEY, VALUE, COMPARATOR, ALLOCATOR>;
4461
4462/// Deduce the template parameters `KEY` and `VALUE` from the `value_type`
4463/// of the initializer_list supplied to the constructor of `map`. Deduce
4464/// the template parameter `COMPARATOR` from the other parameters passed to
4465/// the constructor. This deduction guide does not participate unless the
4466/// supplied allocator is convertible to
4467/// `bsl::allocator<bsl::pair<const KEY, VALUE>>`.
4468template <
4469 class KEY,
4470 class VALUE,
4471 class COMPARATOR,
4472 class ALLOC,
4473 class DEFAULT_ALLOCATOR = bsl::allocator<bsl::pair<const KEY, VALUE>>,
4474 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
4475 >
4476map(std::initializer_list<pair<const KEY, VALUE>>, COMPARATOR, ALLOC *)
4477-> map<KEY, VALUE, COMPARATOR>;
4478
4479/// Deduce the template parameters `KEY` and `VALUE` from the `value_type`
4480/// of the initializer_list supplied to the constructor of `map`. Deduce
4481/// the template parameter `ALLOCATOR` from the other parameter passed to
4482/// the constructor. This deduction guide does not participate unless the
4483/// supplied allocator meets the requirements of a standard allocator.
4484template <
4485 class KEY,
4486 class VALUE,
4487 class ALLOCATOR,
4488 class = bsl::enable_if_t<bsl::IsStdAllocator_v<ALLOCATOR>>
4489 >
4490map(std::initializer_list<pair<const KEY, VALUE>>, ALLOCATOR)
4491-> map<KEY, VALUE, std::less<KEY>, ALLOCATOR>;
4492
4493/// Deduce the template parameters `KEY` and `VALUE` from the `value_type`
4494/// of the initializer_list supplied to the constructor of `map`. This
4495/// deduction guide does not participate unless the supplied allocator is
4496/// convertible to `bsl::allocator<bsl::pair<const KEY, VALUE>>`.
4497template <
4498 class KEY,
4499 class VALUE,
4500 class ALLOC,
4501 class DEFAULT_ALLOCATOR = bsl::allocator<bsl::pair<const KEY, VALUE>>,
4502 class = bsl::enable_if_t<bsl::is_convertible_v<ALLOC *, DEFAULT_ALLOCATOR>>
4503 >
4504map(std::initializer_list<pair<const KEY, VALUE>>, ALLOC *)
4505-> map<KEY, VALUE>;
4506#endif
4507
4508// FREE OPERATORS
4509
4510/// Return `true` if the specified `lhs` and `rhs` objects have the same
4511/// value, and `false` otherwise. Two `map` objects `lhs` and `rhs` have
4512/// the same value if they have the same number of key-value pairs, and each
4513/// element in the ordered sequence of key-value pairs of `lhs` has the same
4514/// value as the corresponding element in the ordered sequence of key-value
4515/// pairs of `rhs`. This method requires that the (template parameter)
4516/// types `KEY` and `VALUE` both be `equality-comparable` (see {Requirements
4517/// on `KEY` and `VALUE`}).
4518template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4519bool operator==(const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& lhs,
4520 const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& rhs);
4521
4522#ifndef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
4523template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4524bool operator!=(const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& lhs,
4525 const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& rhs);
4526 // Return 'true' if the specified 'lhs' and 'rhs' objects do not have the
4527 // same value, and 'false' otherwise. Two 'map' objects 'lhs' and 'rhs' do
4528 // not have the same value if they do not have the same number of key-value
4529 // pairs, or some element in the ordered sequence of key-value pairs of
4530 // 'lhs' does not have the same value as the corresponding element in the
4531 // ordered sequence of key-value pairs of 'rhs'. This method requires that
4532 // the (template parameter) types 'KEY' and 'VALUE' both be
4533 // 'equality-comparable' (see {Requirements on 'KEY' and 'VALUE'}).
4534#endif
4535
4536#ifdef BSLALG_SYNTHTHREEWAYUTIL_AVAILABLE
4537
4538/// Perform a lexicographic three-way comparison of the specified `lhs` and
4539/// the specified `rhs` maps by using the comparison operators of
4540/// `bsl::pair<const KEY, VALUE>` on each element; return the result of that
4541/// comparison.
4542template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4543BloombergLP::bslalg::SynthThreeWayUtil::Result<pair<const KEY, VALUE>>
4544operator<=>(const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& lhs,
4545 const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& rhs);
4546
4547#else
4548
4549template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4550bool operator<(const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& lhs,
4551 const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& rhs);
4552 // Return 'true' if the value of the specified 'lhs' map is
4553 // lexicographically less than that of the specified 'rhs' map, and 'false'
4554 // otherwise. Given iterators 'i' and 'j' over the respective sequences
4555 // '[lhs.begin() .. lhs.end())' and '[rhs.begin() .. rhs.end())', the value
4556 // of map 'lhs' is lexicographically less than that of map 'rhs' if
4557 // 'true == *i < *j' for the first pair of corresponding iterator positions
4558 // where '*i < *j' and '*j < *i' are not both 'false'. If no such
4559 // corresponding iterator position exists, the value of 'lhs' is
4560 // lexicographically less than that of 'rhs' if 'lhs.size() < rhs.size()'.
4561 // This method requires that 'operator<', inducing a total order, be
4562 // defined for 'value_type'.
4563
4564template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4565bool operator>(const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& lhs,
4566 const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& rhs);
4567 // Return 'true' if the value of the specified 'lhs' map is
4568 // lexicographically greater than that of the specified 'rhs' map, and
4569 // 'false' otherwise. The value of map 'lhs' is lexicographically greater
4570 // than that of map 'rhs' if 'rhs' is lexicographically less than 'lhs'
4571 // (see 'operator<'). This method requires that 'operator<', inducing a
4572 // total order, be defined for 'value_type'. Note that this operator
4573 // returns 'rhs < lhs'.
4574
4575template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4576bool operator<=(const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& lhs,
4577 const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& rhs);
4578 // Return 'true' if the value of the specified 'lhs' map is
4579 // lexicographically less than or equal to that of the specified 'rhs' map,
4580 // and 'false' otherwise. The value of map 'lhs' is lexicographically less
4581 // than or equal to that of map 'rhs' if 'rhs' is not lexicographically
4582 // less than 'lhs' (see 'operator<'). This method requires that
4583 // 'operator<', inducing a total order, be defined for 'value_type'. Note
4584 // that this operator returns '!(rhs < lhs)'.
4585
4586template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4587bool operator>=(const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& lhs,
4588 const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& rhs);
4589 // Return 'true' if the value of the specified 'lhs' map is
4590 // lexicographically greater than or equal to that of the specified 'rhs'
4591 // map, and 'false' otherwise. The value of map 'lhs' is lexicographically
4592 // greater than or equal to that of map 'rhs' if 'lhs' is not
4593 // lexicographically less than 'rhs' (see 'operator<'). This method
4594 // requires that 'operator<', inducing a total order, be defined for
4595 // 'value_type'. Note that this operator returns '!(lhs < rhs)'.
4596
4597#endif // BSLALG_SYNTHTHREEWAYUTIL_AVAILABLE
4598
4599// FREE FUNCTIONS
4600
4601/// Erase all the elements in the specified map `m` that satisfy the
4602/// specified predicate `predicate`. Return the number of elements erased.
4603template <class KEY,
4604 class VALUE,
4605 class COMPARATOR,
4606 class ALLOCATOR,
4607 class PREDICATE>
4608typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::size_type
4609erase_if(map<KEY, VALUE, COMPARATOR, ALLOCATOR>& m, PREDICATE predicate);
4610
4611/// Exchange the value and comparator of the specified `a` object with those
4612/// of the specified `b` object; also exchange the allocator of `a` with
4613/// that of `b` if the (template parameter) type `ALLOCATOR` has the
4614/// @ref propagate_on_container_swap trait, and do not modify either allocator
4615/// otherwise. This function provides the no-throw exception-safety
4616/// guarantee if and only if the (template parameter) type `COMPARATOR`
4617/// provides a no-throw swap operation, and provides the basic
4618/// exception-safety guarantee otherwise; if an exception is thrown, both
4619/// objects are left in valid but unspecified states. This operation has
4620/// `O[1]` complexity if either `a` was created with the same allocator as
4621/// `b` or `ALLOCATOR` has the @ref propagate_on_container_swap trait;
4622/// otherwise, it has `O[n + m]` complexity, where `n` and `m` are the number of elements in `a` and `b`, respectively.
4623///
4624/// \note Note that this
4625/// function's support for swapping objects created with different
4626/// allocators when `ALLOCATOR` does not have the
4627/// @ref propagate_on_container_swap trait is a departure from the C++
4628/// Standard.
4629template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4630void swap(map<KEY, VALUE, COMPARATOR, ALLOCATOR>& a,
4631 map<KEY, VALUE, COMPARATOR, ALLOCATOR>& b)
4633
4634// ============================================================================
4635// INLINE FUNCTION DEFINITIONS
4636// ============================================================================
4637
4638 // -----------------
4639 // class DataWrapper
4640 // -----------------
4641
4642// CREATORS
4643template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4644inline
4645map<KEY, VALUE, COMPARATOR, ALLOCATOR>::DataWrapper::DataWrapper(
4646 const COMPARATOR& comparator,
4647 const ALLOCATOR& basicAllocator)
4648: ::bsl::map<KEY, VALUE, COMPARATOR, ALLOCATOR>::Comparator(comparator)
4649, d_pool(basicAllocator)
4650{
4651}
4652
4653template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4654inline
4655map<KEY, VALUE, COMPARATOR, ALLOCATOR>::DataWrapper::DataWrapper(
4656 BloombergLP::bslmf::MovableRef<DataWrapper> original)
4657: ::bsl::map<KEY, VALUE, COMPARATOR, ALLOCATOR>::Comparator(
4658 MoveUtil::access(original).keyComparator())
4659, d_pool(MoveUtil::move(MoveUtil::access(original).d_pool))
4660{
4661}
4662
4663template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4664inline
4665typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::NodeFactory&
4666map<KEY, VALUE, COMPARATOR, ALLOCATOR>::DataWrapper::nodeFactory()
4667{
4668 return d_pool;
4669}
4670
4671// ACCESSORS
4672template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4673inline
4674const typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::NodeFactory&
4675map<KEY, VALUE, COMPARATOR, ALLOCATOR>::DataWrapper::nodeFactory() const
4676{
4677 return d_pool;
4678}
4679
4680 // ------------------------
4681 // class map::value_compare
4682 // ------------------------
4683
4684// CREATORS
4685template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4686inline
4687map<KEY, VALUE, COMPARATOR, ALLOCATOR>::value_compare::value_compare(
4688 COMPARATOR comparator)
4689: comp(comparator)
4690{
4691}
4692
4693// ACCESSORS
4694template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4695inline
4696bool map<KEY, VALUE, COMPARATOR, ALLOCATOR>::value_compare::operator()(
4697 const value_type& x,
4698 const value_type& y) const
4699{
4700 return comp(x.first, y.first);
4701}
4702
4703 // ---------
4704 // class map
4705 // ---------
4706
4707// PRIVATE CLASS METHODS
4708template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4709inline
4710typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::Node *
4711map<KEY, VALUE, COMPARATOR, ALLOCATOR>::toNode(
4712 BloombergLP::bslalg::RbTreeNode *node)
4713{
4714 return static_cast<Node *>(node);
4715}
4716
4717template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4718inline
4719const typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::Node *
4720map<KEY, VALUE, COMPARATOR, ALLOCATOR>::toNode(
4721 const BloombergLP::bslalg::RbTreeNode *node)
4722{
4723 return static_cast<const Node *>(node);
4724}
4725
4726// PRIVATE MANIPULATORS
4727template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4728inline
4729typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::NodeFactory&
4730map<KEY, VALUE, COMPARATOR, ALLOCATOR>::nodeFactory()
4731{
4732 return d_compAndAlloc.nodeFactory();
4733}
4734
4735template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4736inline
4737typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::Comparator&
4738map<KEY, VALUE, COMPARATOR, ALLOCATOR>::comparator()
4739{
4740 return d_compAndAlloc;
4741}
4742
4743template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4744inline
4745void map<KEY, VALUE, COMPARATOR, ALLOCATOR>::quickSwapExchangeAllocators(
4746 map& other)
4747{
4748 BloombergLP::bslalg::RbTreeUtil::swap(&d_tree, &other.d_tree);
4749 nodeFactory().swapExchangeAllocators(other.nodeFactory());
4750
4751 // 'DataWrapper' contains a 'NodeFactory' object and inherits from
4752 // 'Comparator'. If the empty-base-class optimization has been applied to
4753 // 'Comparator', then we must not call 'swap' on it because
4754 // 'sizeof(Comparator) > 0' and, therefore, we will incorrectly swap bytes
4755 // of the 'NodeFactory' members!
4756
4757 if (sizeof(NodeFactory) != sizeof(DataWrapper)) {
4758 comparator().swap(other.comparator());
4759 }
4760}
4761
4762template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4763inline
4764void map<KEY, VALUE, COMPARATOR, ALLOCATOR>::quickSwapRetainAllocators(
4765 map& other)
4766{
4767 BloombergLP::bslalg::RbTreeUtil::swap(&d_tree, &other.d_tree);
4768 nodeFactory().swapRetainAllocators(other.nodeFactory());
4769
4770 // See 'quickSwapExchangeAllocators' (above).
4771
4772 if (sizeof(NodeFactory) != sizeof(DataWrapper)) {
4773 comparator().swap(other.comparator());
4774 }
4775}
4776
4777template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4778template <class INPUT_ITERATOR, class SENTINEL>
4779inline
4780void
4781map<KEY, VALUE, COMPARATOR, ALLOCATOR>::constructFromRange(
4782 INPUT_ITERATOR first,
4783 SENTINEL last)
4784{
4785 if (first == last) {
4786 return; // RETURN
4787 }
4788
4790 BloombergLP::bslstl::IteratorUtil::
4791 canCalculateInsertDistance<INPUT_ITERATOR, SENTINEL>()) {
4792 const size_type numElements = static_cast<size_type>(
4793 BloombergLP::bslstl::IteratorUtil::insertDistance(first, last));
4794 nodeFactory().reserveNodes(numElements);
4795 }
4796
4797 BloombergLP::bslalg::RbTreeUtilTreeProctor<NodeFactory> proctor(
4798 &d_tree,
4799 &nodeFactory());
4800
4801 // The following loop guarantees amortized linear time to insert an ordered
4802 // sequence of values (as required by the standard). If the values are
4803 // in sorted order, we are guaranteed the next node can be inserted as the
4804 // right child of the previous node, and can call 'insertAt' without
4805 // 'findUniqueInsertLocation'.
4806
4807 insert(*first);
4808 BloombergLP::bslalg::RbTreeNode *prevNode = d_tree.rootNode();
4809
4810 while (++first != last) {
4811
4812 const value_type& value = *first;
4813 if (this->comparator()(value.first, *prevNode)) {
4814 // The values are not in order, so insert them normally.
4815 insert(value);
4816 insertFromRange(++first, last);
4817 break;
4818 }
4819
4820 if (this->comparator()(*prevNode, value.first)) {
4821 BloombergLP::bslalg::RbTreeNode *node =
4822 nodeFactory().emplaceIntoNewNode(value);
4823 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
4824 prevNode,
4825 false,
4826 node);
4827 prevNode = node;
4828 }
4829 }
4830
4831 proctor.release();
4832}
4833
4834#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
4835 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
4836
4837template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4838template <class INPUT_ITERATOR, class SENTINEL>
4839inline
4840void
4841map<KEY, VALUE, COMPARATOR, ALLOCATOR>::constructFromRange(
4842 INPUT_ITERATOR first,
4843 SENTINEL last,
4844 size_t numElements)
4845
4846{
4848 !BloombergLP::bslstl::IteratorUtil
4849 ::canCalculateInsertDistance<INPUT_ITERATOR, SENTINEL>()
4850 || numElements == static_cast<size_type>(
4851 BloombergLP::bslstl::IteratorUtil::insertDistance(first, last))));
4852
4853 if (first == last) {
4854 return; // RETURN
4855 }
4856
4857 if (0 < numElements) {
4858 nodeFactory().reserveNodes(numElements);
4859 }
4860
4861 BloombergLP::bslalg::RbTreeUtilTreeProctor<NodeFactory> proctor(
4862 &d_tree,
4863 &nodeFactory());
4864
4865 // The following loop guarantees amortized linear time to insert an ordered
4866 // sequence of values (as required by the standard). If the values are
4867 // in sorted order, we are guaranteed the next node can be inserted as the
4868 // right child of the previous node, and can call 'insertAt' without
4869 // 'findUniqueInsertLocation'.
4870
4871 insert(*first); --numElements;
4872 BloombergLP::bslalg::RbTreeNode *prevNode = d_tree.rootNode();
4873
4874 while (++first != last) {
4875
4876 const value_type& value = *first;
4877 if (this->comparator()(value.first, *prevNode)) {
4878 // The values are not in order, so insert them normally.
4879 insert(value); --numElements;
4880 insertFromRange(++first, last, numElements);
4881 break;
4882 }
4883
4884 if (this->comparator()(*prevNode, value.first)) {
4885 BloombergLP::bslalg::RbTreeNode *node =
4886 nodeFactory().emplaceIntoNewNode(value);
4887 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
4888 prevNode,
4889 false,
4890 node);
4891 --numElements;
4892 prevNode = node;
4893 }
4894 }
4895
4896 proctor.release();
4897}
4898
4899#endif
4900
4901template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4902template <class INPUT_ITERATOR, class SENTINEL>
4903inline
4904void map<KEY, VALUE, COMPARATOR, ALLOCATOR>::insertFromRange(
4905 INPUT_ITERATOR first,
4906 SENTINEL last)
4907{
4908 ///Implementation Notes
4909 ///--------------------
4910 // First, consume currently held free nodes. Free nodes may be available
4911 // from previous insertions that where skipped due to collisions with
4912 // keys already in the map or from nodes reserved in `constructFromRange`.
4913 //
4914 // If those nodes are insufficient *and* one can calculate the remaining
4915 // number of elements, then reserve exactly that many free nodes. There is
4916 // no more than one call to 'reserveNodes' per invocation of this method,
4917 // hence the use of 'BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY'.
4918 //
4919 // When reserving nodes, we assume the elements remaining to be inserted
4920 // have unique keys that do not duplicate any keys already in the container
4921 // If there are any duplicates, this container will have free nodes on
4922 // return from this method.
4923
4924 while (first != last) {
4925
4926 if (BloombergLP::bslstl::IteratorUtil
4927 ::canCalculateInsertDistance<INPUT_ITERATOR, SENTINEL>()
4929 !nodeFactory().hasFreeNodes())) {
4930 const size_type numElements = static_cast<size_type>(
4931 BloombergLP::bslstl::IteratorUtil::insertDistance(first, last));
4932
4933 nodeFactory().reserveNodes(numElements);
4934 }
4935
4936 insert(*first);
4937 ++first;
4938 }
4939}
4940
4941#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
4942 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
4943
4944template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4945template <class INPUT_ITERATOR, class SENTINEL>
4946inline
4947void map<KEY, VALUE, COMPARATOR, ALLOCATOR>::insertFromRange(
4948 INPUT_ITERATOR first,
4949 SENTINEL last,
4950 size_t numElements)
4951{
4953 !BloombergLP::bslstl::IteratorUtil
4954 ::canCalculateInsertDistance<INPUT_ITERATOR, SENTINEL>()
4955 || numElements == static_cast<size_type>(
4956 BloombergLP::bslstl::IteratorUtil::insertDistance(first, last))));
4957
4958 while (first != last) {
4959
4961 !nodeFactory().hasFreeNodes())) {
4962 nodeFactory().reserveNodes(numElements);
4963 }
4964
4965 insert(*first);
4966 --numElements;
4967 ++first;
4968 }
4969}
4970
4971#endif
4972
4973// PRIVATE ACCESSORS
4974template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4975inline
4976const typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::NodeFactory&
4977map<KEY, VALUE, COMPARATOR, ALLOCATOR>::nodeFactory() const
4978{
4979 return d_compAndAlloc.nodeFactory();
4980}
4981
4982template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4983inline
4984const typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::Comparator&
4985map<KEY, VALUE, COMPARATOR, ALLOCATOR>::comparator() const
4986{
4987 return d_compAndAlloc;
4988}
4989
4990// CREATORS
4991template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
4992inline
4993map<KEY, VALUE, COMPARATOR, ALLOCATOR>::map()
4994: d_compAndAlloc(COMPARATOR(), ALLOCATOR())
4995, d_tree()
4996{
4997}
4998
4999template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5000inline
5001map<KEY, VALUE, COMPARATOR, ALLOCATOR>::map(const ALLOCATOR& basicAllocator)
5002: d_compAndAlloc(COMPARATOR(), basicAllocator)
5003, d_tree()
5004{
5005}
5006
5007template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5008inline
5009map<KEY, VALUE, COMPARATOR, ALLOCATOR>::map(const map& original)
5010: d_compAndAlloc(original.comparator().keyComparator(),
5011 AllocatorTraits::select_on_container_copy_construction(
5012 original.nodeFactory().allocator()))
5013, d_tree()
5014{
5015 if (0 < original.size()) {
5016 nodeFactory().reserveNodes(original.size());
5017 BloombergLP::bslalg::RbTreeUtil::copyTree(&d_tree,
5018 original.d_tree,
5019 &nodeFactory());
5020 }
5021}
5022
5023template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5024inline
5025map<KEY, VALUE, COMPARATOR, ALLOCATOR>::map(
5026 BloombergLP::bslmf::MovableRef<map> original)
5027: d_compAndAlloc(MoveUtil::move(MoveUtil::access(original).d_compAndAlloc))
5028, d_tree()
5029{
5030 map& lvalue = original;
5031 BloombergLP::bslalg::RbTreeUtil::swap(&d_tree, &lvalue.d_tree);
5032}
5033
5034template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5035inline
5036map<KEY, VALUE, COMPARATOR, ALLOCATOR>::map(const map& original,
5037 const typename type_identity<ALLOCATOR>::type& basicAllocator)
5038: d_compAndAlloc(original.comparator().keyComparator(), basicAllocator)
5039, d_tree()
5040{
5041 if (0 < original.size()) {
5042 nodeFactory().reserveNodes(original.size());
5043 BloombergLP::bslalg::RbTreeUtil::copyTree(&d_tree,
5044 original.d_tree,
5045 &nodeFactory());
5046 }
5047}
5048
5049template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5050inline
5051map<KEY, VALUE, COMPARATOR, ALLOCATOR>::map(
5052 BloombergLP::bslmf::MovableRef<map> original,
5053 const typename type_identity<ALLOCATOR>::type& basicAllocator)
5054: d_compAndAlloc(MoveUtil::access(original).comparator().keyComparator(),
5055 basicAllocator)
5056, d_tree()
5057{
5058 map& lvalue = original;
5059
5061 nodeFactory().allocator() == lvalue.nodeFactory().allocator())) {
5062 d_compAndAlloc.nodeFactory().adopt(
5063 MoveUtil::move(lvalue.d_compAndAlloc.nodeFactory()));
5064 BloombergLP::bslalg::RbTreeUtil::swap(&d_tree, &lvalue.d_tree);
5065 }
5066 else if (0 < lvalue.size()) {
5067 nodeFactory().reserveNodes(lvalue.size());
5068 BloombergLP::bslalg::RbTreeUtil::moveTree(&d_tree,
5069 &lvalue.d_tree,
5070 &nodeFactory(),
5071 &lvalue.nodeFactory());
5072 }
5073}
5074
5075template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5076template <class INPUT_ITERATOR>
5077inline
5078map<KEY, VALUE, COMPARATOR, ALLOCATOR>::map(INPUT_ITERATOR first,
5079 INPUT_ITERATOR last,
5080 const COMPARATOR& comparator,
5081 const ALLOCATOR& basicAllocator)
5082: d_compAndAlloc(comparator, basicAllocator)
5083, d_tree()
5084{
5085 constructFromRange(first, last);
5086}
5087
5088template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5089template <class INPUT_ITERATOR>
5090inline
5091map<KEY, VALUE, COMPARATOR, ALLOCATOR>::map(INPUT_ITERATOR first,
5092 INPUT_ITERATOR last,
5093 const ALLOCATOR& basicAllocator)
5094: d_compAndAlloc(COMPARATOR(), basicAllocator)
5095, d_tree()
5096{
5097 map other(first, last, COMPARATOR(), nodeFactory().allocator());
5098 quickSwapRetainAllocators(other);
5099}
5100
5101#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
5102template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5103inline
5104map<KEY, VALUE, COMPARATOR, ALLOCATOR>::map(
5105 std::initializer_list<value_type> values,
5106 const COMPARATOR& comparator,
5107 const ALLOCATOR& basicAllocator)
5108: map(values.begin(), values.end(), comparator, basicAllocator)
5109{
5110}
5111
5112template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5113inline
5114map<KEY, VALUE, COMPARATOR, ALLOCATOR>::map(
5115 std::initializer_list<value_type> values,
5116 const ALLOCATOR& basicAllocator)
5117: map(values.begin(), values.end(), COMPARATOR(), basicAllocator)
5118{
5119}
5120#endif
5121
5122template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5123inline
5124map<KEY, VALUE, COMPARATOR, ALLOCATOR>::~map()
5125{
5126 clear();
5127}
5128
5129// MANIPULATORS
5130template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5131inline
5132map<KEY, VALUE, COMPARATOR, ALLOCATOR>&
5133map<KEY, VALUE, COMPARATOR, ALLOCATOR>::operator=(const map& rhs)
5134{
5135 if (BSLS_PERFORMANCEHINT_PREDICT_LIKELY(this != &rhs)) {
5136 if (AllocatorTraits::propagate_on_container_copy_assignment::value) {
5137 map other(rhs, rhs.nodeFactory().allocator());
5138 quickSwapExchangeAllocators(other);
5139 }
5140 else {
5141 map other(rhs, nodeFactory().allocator());
5142 quickSwapRetainAllocators(other);
5143 }
5144 }
5145 return *this;
5146}
5147
5148template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5149inline
5150map<KEY, VALUE, COMPARATOR, ALLOCATOR>&
5151map<KEY, VALUE, COMPARATOR, ALLOCATOR>::operator=(
5152 BloombergLP::bslmf::MovableRef<map> rhs)
5154 AllocatorTraits::is_always_equal::value &&
5155 std::is_nothrow_move_assignable<COMPARATOR>::value)
5156{
5157 map& lvalue = rhs;
5158
5159 if (BSLS_PERFORMANCEHINT_PREDICT_LIKELY(this != &lvalue)) {
5160 if (nodeFactory().allocator() == lvalue.nodeFactory().allocator()) {
5161 map other(MoveUtil::move(lvalue));
5162 quickSwapRetainAllocators(other);
5163 }
5164 else if (
5165 AllocatorTraits::propagate_on_container_move_assignment::value) {
5166 map other(MoveUtil::move(lvalue));
5167 quickSwapExchangeAllocators(other);
5168 }
5169 else {
5170 map other(MoveUtil::move(lvalue), nodeFactory().allocator());
5171 quickSwapRetainAllocators(other);
5172 }
5173 }
5174 return *this;
5175}
5176
5177#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
5178template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5179inline
5180map<KEY, VALUE, COMPARATOR, ALLOCATOR>&
5181map<KEY, VALUE, COMPARATOR, ALLOCATOR>::operator=(
5182 std::initializer_list<value_type> values)
5183{
5184 clear();
5185 insert(values.begin(), values.end());
5186 return *this;
5187}
5188#endif
5189
5190template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5191inline
5192typename add_lvalue_reference<VALUE>::type
5193map<KEY, VALUE, COMPARATOR, ALLOCATOR>::operator[](const key_type& key)
5194{
5195 iterator iter = lower_bound(key);
5196 if (iter == end() || this->comparator()(key, *iter.node())) {
5197#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
5198 iter = emplace_hint(iter,
5199 std::piecewise_construct,
5200 std::forward_as_tuple(key),
5201 std::forward_as_tuple());
5202#else
5203 BloombergLP::bsls::ObjectBuffer<VALUE> temp; // for default 'VALUE'
5204
5205 ALLOCATOR alloc = nodeFactory().allocator();
5206
5207 AllocatorTraits::construct(alloc, temp.address());
5208
5209 BloombergLP::bslma::DestructorGuard<VALUE> guard(temp.address());
5210
5211 // Unfortunately, in C++03, there are user types where a MovableRef
5212 // will not safely degrade to a lvalue reference when a move
5213 // constructor is not available, so 'move' cannot be used directly on a
5214 // user supplied type. See internal bug report 99039150.
5215 iter = emplace_hint(iter, key, temp.object());
5216#endif
5217 }
5218 return iter->second;
5219}
5220
5221template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5222inline
5223typename add_lvalue_reference<VALUE>::type
5224map<KEY, VALUE, COMPARATOR, ALLOCATOR>::operator[](
5225 BloombergLP::bslmf::MovableRef<key_type> key)
5226{
5227 key_type& lvalue = key;
5228
5229 iterator iter = lower_bound(lvalue);
5230 if (iter == end() || this->comparator()(lvalue, *iter.node())) {
5231#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
5232 iter = emplace_hint(
5233 iter,
5234 std::piecewise_construct,
5235 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(key_type, key)),
5236 std::forward_as_tuple());
5237#else
5238 BloombergLP::bsls::ObjectBuffer<VALUE> temp; // for default 'VALUE'
5239
5240 ALLOCATOR alloc = nodeFactory().allocator();
5241
5242 AllocatorTraits::construct(alloc, temp.address());
5243
5244 BloombergLP::bslma::DestructorGuard<VALUE> guard(temp.address());
5245
5246 // Unfortunately, in C++03, there are user types where a MovableRef
5247 // will not safely degrade to a lvalue reference when a move
5248 // constructor is not available, so 'move' cannot be used directly on a
5249 // user supplied type. See internal bug report 99039150.
5250 iter = emplace_hint(iter, lvalue, temp.object());
5251#endif
5252 }
5253 return iter->second;
5254}
5255
5256template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5257typename add_lvalue_reference<VALUE>::type
5258map<KEY, VALUE, COMPARATOR, ALLOCATOR>::at(const key_type& key)
5259{
5260 BloombergLP::bslalg::RbTreeNode *node =
5261 BloombergLP::bslalg::RbTreeUtil::find(d_tree, this->comparator(), key);
5262 if (d_tree.sentinel() == node) {
5263 BloombergLP::bslstl::StdExceptUtil::throwOutOfRange(
5264 "map<...>::at(key_type): invalid key value");
5265 }
5266 return toNode(node)->value().second;
5267}
5268
5269template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5270inline
5271typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
5272map<KEY, VALUE, COMPARATOR, ALLOCATOR>::begin() BSLS_KEYWORD_NOEXCEPT
5273{
5274 return iterator(d_tree.firstNode());
5275}
5276
5277template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5278inline
5279typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
5280map<KEY, VALUE, COMPARATOR, ALLOCATOR>::end() BSLS_KEYWORD_NOEXCEPT
5281{
5282 return iterator(d_tree.sentinel());
5283}
5284
5285template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5286inline
5287typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::reverse_iterator
5288map<KEY, VALUE, COMPARATOR, ALLOCATOR>::rbegin() BSLS_KEYWORD_NOEXCEPT
5289{
5290 return reverse_iterator(end());
5291}
5292
5293template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5294inline
5295typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::reverse_iterator
5296map<KEY, VALUE, COMPARATOR, ALLOCATOR>::rend() BSLS_KEYWORD_NOEXCEPT
5297{
5298 return reverse_iterator(begin());
5299}
5300
5301template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5302inline
5303pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
5304map<KEY, VALUE, COMPARATOR, ALLOCATOR>::insert(const value_type& value)
5305{
5306 int comparisonResult;
5307 BloombergLP::bslalg::RbTreeNode *insertLocation =
5308 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
5309 &comparisonResult,
5310 &d_tree,
5311 this->comparator(),
5312 value.first);
5313 if (!comparisonResult) {
5314 return pair<iterator, bool>(iterator(insertLocation), false); // RETURN
5315 }
5316
5317 BloombergLP::bslalg::RbTreeNode *node =
5318 nodeFactory().emplaceIntoNewNode(value);
5319 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
5320 insertLocation,
5321 comparisonResult < 0,
5322 node);
5323 return pair<iterator, bool>(iterator(node), true);
5324}
5325
5326template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5327inline
5328pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
5329map<KEY, VALUE, COMPARATOR, ALLOCATOR>::insert(
5330 BloombergLP::bslmf::MovableRef<value_type> value)
5331{
5332 value_type& lvalue = value;
5333
5334 int comparisonResult;
5335 BloombergLP::bslalg::RbTreeNode *insertLocation =
5336 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
5337 &comparisonResult,
5338 &d_tree,
5339 this->comparator(),
5340 lvalue.first);
5341 if (!comparisonResult) {
5342 return pair<iterator, bool>(iterator(insertLocation), false); // RETURN
5343 }
5344
5345 BloombergLP::bslalg::RbTreeNode *node =
5346 nodeFactory().emplaceIntoNewNode(MoveUtil::move(lvalue));
5347 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
5348 insertLocation,
5349 comparisonResult < 0,
5350 node);
5351 return pair<iterator, bool>(iterator(node), true);
5352}
5353
5354template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5355template <class INPUT_ITERATOR>
5356inline
5357void map<KEY, VALUE, COMPARATOR, ALLOCATOR>::insert(INPUT_ITERATOR first,
5358 INPUT_ITERATOR last)
5359{
5360 insertFromRange(first, last);
5361}
5362
5363#if defined(BSLS_PLATFORM_CMP_SUN) && BSLS_PLATFORM_CMP_VERSION < 0x5130
5364template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5365inline
5366void map<KEY, VALUE, COMPARATOR, ALLOCATOR>::insert(const_iterator first,
5367 const_iterator last)
5368{
5369 while (first != last) {
5370 insert(*first);
5371 ++first;
5372 }
5373}
5374#endif
5375
5376template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5377inline
5378typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
5379map<KEY, VALUE, COMPARATOR, ALLOCATOR>::insert(const_iterator hint,
5380 const value_type& value)
5381{
5382 BloombergLP::bslalg::RbTreeNode *hintNode =
5383 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
5384 int comparisonResult;
5385 BloombergLP::bslalg::RbTreeNode *insertLocation =
5386 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
5387 &comparisonResult,
5388 &d_tree,
5389 this->comparator(),
5390 value.first,
5391 hintNode);
5392 if (!comparisonResult) {
5393 return iterator(insertLocation); // RETURN
5394 }
5395
5396 BloombergLP::bslalg::RbTreeNode *node =
5397 nodeFactory().emplaceIntoNewNode(value);
5398 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
5399 insertLocation,
5400 comparisonResult < 0,
5401 node);
5402 return iterator(node);
5403}
5404
5405template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5406inline
5407typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
5408map<KEY, VALUE, COMPARATOR, ALLOCATOR>::insert(
5409 const_iterator hint,
5410 BloombergLP::bslmf::MovableRef<value_type> value)
5411{
5412 value_type& lvalue = value;
5413
5414 BloombergLP::bslalg::RbTreeNode *hintNode =
5415 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
5416 int comparisonResult;
5417 BloombergLP::bslalg::RbTreeNode *insertLocation =
5418 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
5419 &comparisonResult,
5420 &d_tree,
5421 this->comparator(),
5422 lvalue.first,
5423 hintNode);
5424 if (!comparisonResult) {
5425 return iterator(insertLocation); // RETURN
5426 }
5427
5428 BloombergLP::bslalg::RbTreeNode *node =
5429 nodeFactory().emplaceIntoNewNode(MoveUtil::move(lvalue));
5430
5431 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
5432 insertLocation,
5433 comparisonResult < 0,
5434 node);
5435 return iterator(node);
5436}
5437
5438#if defined(BSLS_COMPILERFEATURES_SUPPORT_GENERALIZED_INITIALIZERS)
5439template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5440inline
5441void map<KEY, VALUE, COMPARATOR, ALLOCATOR>::insert(
5442 std::initializer_list<value_type> values)
5443{
5444 insert(values.begin(), values.end());
5445}
5446#endif
5447
5448// {{{ BEGIN GENERATED CODE
5449// The generated code below is a workaround for the absence of perfect
5450// forwarding in some compilers.
5451template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5452template <class BDE_OTHER_TYPE>
5453inline
5454pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
5455map<KEY, VALUE, COMPARATOR, ALLOCATOR>::insert_or_assign(const key_type& key,
5456 BSLS_COMPILERFEATURES_FORWARD_REF(BDE_OTHER_TYPE) obj)
5457{
5458 int comparisonResult;
5459 BloombergLP::bslalg::RbTreeNode *insertLocation =
5460 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
5461 &comparisonResult,
5462 &d_tree,
5463 this->comparator(),
5464 key);
5465
5466 if (!comparisonResult) {
5467 iterator(insertLocation)->second =
5468 BSLS_COMPILERFEATURES_FORWARD(BDE_OTHER_TYPE, obj);
5469 return pair<iterator, bool>(iterator(insertLocation), false);
5470 }
5471
5472 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
5473 key, BSLS_COMPILERFEATURES_FORWARD(BDE_OTHER_TYPE, obj));
5474
5475 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
5476 insertLocation,
5477 comparisonResult < 0,
5478 node);
5479
5480 return pair<iterator, bool>(iterator(node), true);
5481}
5482
5483template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5484template <class BDE_OTHER_TYPE>
5485inline
5486typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
5487map<KEY, VALUE, COMPARATOR, ALLOCATOR>::insert_or_assign(const_iterator hint,
5488 const key_type& key,
5489 BSLS_COMPILERFEATURES_FORWARD_REF(BDE_OTHER_TYPE) obj)
5490{
5491 BloombergLP::bslalg::RbTreeNode *hintNode =
5492 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
5493 int comparisonResult;
5494 BloombergLP::bslalg::RbTreeNode *insertLocation =
5495 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
5496 &comparisonResult,
5497 &d_tree,
5498 this->comparator(),
5499 key,
5500 hintNode);
5501
5502 if (!comparisonResult) {
5503 iterator(insertLocation)->second =
5504 BSLS_COMPILERFEATURES_FORWARD(BDE_OTHER_TYPE, obj);
5505 return iterator(insertLocation);
5506 }
5507
5508 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
5509 key, BSLS_COMPILERFEATURES_FORWARD(BDE_OTHER_TYPE, obj));
5510
5511 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
5512 insertLocation,
5513 comparisonResult < 0,
5514 node);
5515
5516 return iterator(node);
5517}
5518
5519template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5520template <class BDE_OTHER_TYPE>
5521inline
5522pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
5523map<KEY, VALUE, COMPARATOR, ALLOCATOR>::insert_or_assign(
5524 BloombergLP::bslmf::MovableRef<key_type> key,
5525 BSLS_COMPILERFEATURES_FORWARD_REF(BDE_OTHER_TYPE) obj)
5526{
5527 int comparisonResult;
5528 BloombergLP::bslalg::RbTreeNode *insertLocation =
5529 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
5530 &comparisonResult,
5531 &d_tree,
5532 this->comparator(),
5533 key);
5534
5535 if (!comparisonResult) {
5536 iterator(insertLocation)->second =
5537 BSLS_COMPILERFEATURES_FORWARD(BDE_OTHER_TYPE, obj);
5538 return pair<iterator, bool>(iterator(insertLocation), false);
5539 }
5540
5541 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
5542 BSLS_COMPILERFEATURES_FORWARD(key_type, key),
5543 BSLS_COMPILERFEATURES_FORWARD(BDE_OTHER_TYPE, obj));
5544
5545 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
5546 insertLocation,
5547 comparisonResult < 0,
5548 node);
5549
5550 return pair<iterator, bool>(iterator(node), true);
5551}
5552
5553template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5554template <class BDE_OTHER_TYPE>
5555inline
5556typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
5557map<KEY, VALUE, COMPARATOR, ALLOCATOR>::insert_or_assign(
5558 const_iterator hint,
5559 BloombergLP::bslmf::MovableRef<key_type> key,
5560 BSLS_COMPILERFEATURES_FORWARD_REF(BDE_OTHER_TYPE) obj)
5561{
5562 BloombergLP::bslalg::RbTreeNode *hintNode =
5563 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
5564 int comparisonResult;
5565 BloombergLP::bslalg::RbTreeNode *insertLocation =
5566 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
5567 &comparisonResult,
5568 &d_tree,
5569 this->comparator(),
5570 key,
5571 hintNode);
5572
5573 if (!comparisonResult) {
5574 iterator(insertLocation)->second =
5575 BSLS_COMPILERFEATURES_FORWARD(BDE_OTHER_TYPE, obj);
5576 return iterator(insertLocation);
5577 }
5578
5579 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
5580 BSLS_COMPILERFEATURES_FORWARD(key_type, key),
5581 BSLS_COMPILERFEATURES_FORWARD(BDE_OTHER_TYPE, obj));
5582
5583 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
5584 insertLocation,
5585 comparisonResult < 0,
5586 node);
5587
5588 return iterator(node);
5589}
5590// }}} END GENERATED CODE
5591
5592#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
5593// {{{ BEGIN GENERATED CODE
5594// Command line: sim_cpp11_features.pl bslstl_map.h
5595#ifndef BSLSTL_MAP_VARIADIC_LIMIT
5596#define BSLSTL_MAP_VARIADIC_LIMIT 10
5597#endif
5598#ifndef BSLSTL_MAP_VARIADIC_LIMIT_F
5599#define BSLSTL_MAP_VARIADIC_LIMIT_F BSLSTL_MAP_VARIADIC_LIMIT
5600#endif
5601
5602#if BSLSTL_MAP_VARIADIC_LIMIT_F >= 0
5603template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5604inline
5605pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
5606map<KEY, VALUE, COMPARATOR, ALLOCATOR>::emplace(
5607 )
5608{
5609 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
5610 );
5611 int comparisonResult;
5612 BloombergLP::bslalg::RbTreeNode *insertLocation =
5613 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
5614 &comparisonResult,
5615 &d_tree,
5616 this->comparator(),
5617 static_cast<const Node *>(node)->value().first);
5618 if (!comparisonResult) {
5619 nodeFactory().deleteNode(node);
5620 return pair<iterator, bool>(iterator(insertLocation), false);
5621 }
5622
5623 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
5624 insertLocation,
5625 comparisonResult < 0,
5626 node);
5627 return pair<iterator, bool>(iterator(node), true);
5628}
5629#endif // BSLSTL_MAP_VARIADIC_LIMIT_F >= 0
5630
5631#if BSLSTL_MAP_VARIADIC_LIMIT_F >= 1
5632template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5633template <class Args_01>
5634inline
5635pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
5636map<KEY, VALUE, COMPARATOR, ALLOCATOR>::emplace(
5637 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01)
5638{
5639 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
5640 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01));
5641 int comparisonResult;
5642 BloombergLP::bslalg::RbTreeNode *insertLocation =
5643 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
5644 &comparisonResult,
5645 &d_tree,
5646 this->comparator(),
5647 static_cast<const Node *>(node)->value().first);
5648 if (!comparisonResult) {
5649 nodeFactory().deleteNode(node);
5650 return pair<iterator, bool>(iterator(insertLocation), false);
5651 }
5652
5653 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
5654 insertLocation,
5655 comparisonResult < 0,
5656 node);
5657 return pair<iterator, bool>(iterator(node), true);
5658}
5659#endif // BSLSTL_MAP_VARIADIC_LIMIT_F >= 1
5660
5661#if BSLSTL_MAP_VARIADIC_LIMIT_F >= 2
5662template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5663template <class Args_01,
5664 class Args_02>
5665inline
5666pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
5667map<KEY, VALUE, COMPARATOR, ALLOCATOR>::emplace(
5668 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
5669 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02)
5670{
5671 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
5672 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
5673 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02));
5674 int comparisonResult;
5675 BloombergLP::bslalg::RbTreeNode *insertLocation =
5676 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
5677 &comparisonResult,
5678 &d_tree,
5679 this->comparator(),
5680 static_cast<const Node *>(node)->value().first);
5681 if (!comparisonResult) {
5682 nodeFactory().deleteNode(node);
5683 return pair<iterator, bool>(iterator(insertLocation), false);
5684 }
5685
5686 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
5687 insertLocation,
5688 comparisonResult < 0,
5689 node);
5690 return pair<iterator, bool>(iterator(node), true);
5691}
5692#endif // BSLSTL_MAP_VARIADIC_LIMIT_F >= 2
5693
5694#if BSLSTL_MAP_VARIADIC_LIMIT_F >= 3
5695template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5696template <class Args_01,
5697 class Args_02,
5698 class Args_03>
5699inline
5700pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
5701map<KEY, VALUE, COMPARATOR, ALLOCATOR>::emplace(
5702 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
5703 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
5704 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03)
5705{
5706 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
5707 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
5708 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
5709 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03));
5710 int comparisonResult;
5711 BloombergLP::bslalg::RbTreeNode *insertLocation =
5712 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
5713 &comparisonResult,
5714 &d_tree,
5715 this->comparator(),
5716 static_cast<const Node *>(node)->value().first);
5717 if (!comparisonResult) {
5718 nodeFactory().deleteNode(node);
5719 return pair<iterator, bool>(iterator(insertLocation), false);
5720 }
5721
5722 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
5723 insertLocation,
5724 comparisonResult < 0,
5725 node);
5726 return pair<iterator, bool>(iterator(node), true);
5727}
5728#endif // BSLSTL_MAP_VARIADIC_LIMIT_F >= 3
5729
5730#if BSLSTL_MAP_VARIADIC_LIMIT_F >= 4
5731template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5732template <class Args_01,
5733 class Args_02,
5734 class Args_03,
5735 class Args_04>
5736inline
5737pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
5738map<KEY, VALUE, COMPARATOR, ALLOCATOR>::emplace(
5739 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
5740 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
5741 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
5742 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04)
5743{
5744 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
5745 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
5746 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
5747 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
5748 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04));
5749 int comparisonResult;
5750 BloombergLP::bslalg::RbTreeNode *insertLocation =
5751 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
5752 &comparisonResult,
5753 &d_tree,
5754 this->comparator(),
5755 static_cast<const Node *>(node)->value().first);
5756 if (!comparisonResult) {
5757 nodeFactory().deleteNode(node);
5758 return pair<iterator, bool>(iterator(insertLocation), false);
5759 }
5760
5761 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
5762 insertLocation,
5763 comparisonResult < 0,
5764 node);
5765 return pair<iterator, bool>(iterator(node), true);
5766}
5767#endif // BSLSTL_MAP_VARIADIC_LIMIT_F >= 4
5768
5769#if BSLSTL_MAP_VARIADIC_LIMIT_F >= 5
5770template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5771template <class Args_01,
5772 class Args_02,
5773 class Args_03,
5774 class Args_04,
5775 class Args_05>
5776inline
5777pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
5778map<KEY, VALUE, COMPARATOR, ALLOCATOR>::emplace(
5779 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
5780 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
5781 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
5782 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
5783 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05)
5784{
5785 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
5786 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
5787 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
5788 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
5789 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
5790 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05));
5791 int comparisonResult;
5792 BloombergLP::bslalg::RbTreeNode *insertLocation =
5793 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
5794 &comparisonResult,
5795 &d_tree,
5796 this->comparator(),
5797 static_cast<const Node *>(node)->value().first);
5798 if (!comparisonResult) {
5799 nodeFactory().deleteNode(node);
5800 return pair<iterator, bool>(iterator(insertLocation), false);
5801 }
5802
5803 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
5804 insertLocation,
5805 comparisonResult < 0,
5806 node);
5807 return pair<iterator, bool>(iterator(node), true);
5808}
5809#endif // BSLSTL_MAP_VARIADIC_LIMIT_F >= 5
5810
5811#if BSLSTL_MAP_VARIADIC_LIMIT_F >= 6
5812template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5813template <class Args_01,
5814 class Args_02,
5815 class Args_03,
5816 class Args_04,
5817 class Args_05,
5818 class Args_06>
5819inline
5820pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
5821map<KEY, VALUE, COMPARATOR, ALLOCATOR>::emplace(
5822 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
5823 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
5824 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
5825 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
5826 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
5827 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06)
5828{
5829 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
5830 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
5831 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
5832 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
5833 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
5834 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
5835 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06));
5836 int comparisonResult;
5837 BloombergLP::bslalg::RbTreeNode *insertLocation =
5838 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
5839 &comparisonResult,
5840 &d_tree,
5841 this->comparator(),
5842 static_cast<const Node *>(node)->value().first);
5843 if (!comparisonResult) {
5844 nodeFactory().deleteNode(node);
5845 return pair<iterator, bool>(iterator(insertLocation), false);
5846 }
5847
5848 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
5849 insertLocation,
5850 comparisonResult < 0,
5851 node);
5852 return pair<iterator, bool>(iterator(node), true);
5853}
5854#endif // BSLSTL_MAP_VARIADIC_LIMIT_F >= 6
5855
5856#if BSLSTL_MAP_VARIADIC_LIMIT_F >= 7
5857template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5858template <class Args_01,
5859 class Args_02,
5860 class Args_03,
5861 class Args_04,
5862 class Args_05,
5863 class Args_06,
5864 class Args_07>
5865inline
5866pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
5867map<KEY, VALUE, COMPARATOR, ALLOCATOR>::emplace(
5868 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
5869 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
5870 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
5871 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
5872 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
5873 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
5874 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07)
5875{
5876 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
5877 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
5878 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
5879 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
5880 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
5881 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
5882 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
5883 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07));
5884 int comparisonResult;
5885 BloombergLP::bslalg::RbTreeNode *insertLocation =
5886 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
5887 &comparisonResult,
5888 &d_tree,
5889 this->comparator(),
5890 static_cast<const Node *>(node)->value().first);
5891 if (!comparisonResult) {
5892 nodeFactory().deleteNode(node);
5893 return pair<iterator, bool>(iterator(insertLocation), false);
5894 }
5895
5896 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
5897 insertLocation,
5898 comparisonResult < 0,
5899 node);
5900 return pair<iterator, bool>(iterator(node), true);
5901}
5902#endif // BSLSTL_MAP_VARIADIC_LIMIT_F >= 7
5903
5904#if BSLSTL_MAP_VARIADIC_LIMIT_F >= 8
5905template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5906template <class Args_01,
5907 class Args_02,
5908 class Args_03,
5909 class Args_04,
5910 class Args_05,
5911 class Args_06,
5912 class Args_07,
5913 class Args_08>
5914inline
5915pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
5916map<KEY, VALUE, COMPARATOR, ALLOCATOR>::emplace(
5917 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
5918 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
5919 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
5920 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
5921 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
5922 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
5923 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
5924 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08)
5925{
5926 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
5927 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
5928 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
5929 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
5930 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
5931 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
5932 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
5933 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
5934 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08));
5935 int comparisonResult;
5936 BloombergLP::bslalg::RbTreeNode *insertLocation =
5937 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
5938 &comparisonResult,
5939 &d_tree,
5940 this->comparator(),
5941 static_cast<const Node *>(node)->value().first);
5942 if (!comparisonResult) {
5943 nodeFactory().deleteNode(node);
5944 return pair<iterator, bool>(iterator(insertLocation), false);
5945 }
5946
5947 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
5948 insertLocation,
5949 comparisonResult < 0,
5950 node);
5951 return pair<iterator, bool>(iterator(node), true);
5952}
5953#endif // BSLSTL_MAP_VARIADIC_LIMIT_F >= 8
5954
5955#if BSLSTL_MAP_VARIADIC_LIMIT_F >= 9
5956template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
5957template <class Args_01,
5958 class Args_02,
5959 class Args_03,
5960 class Args_04,
5961 class Args_05,
5962 class Args_06,
5963 class Args_07,
5964 class Args_08,
5965 class Args_09>
5966inline
5967pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
5968map<KEY, VALUE, COMPARATOR, ALLOCATOR>::emplace(
5969 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
5970 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
5971 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
5972 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
5973 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
5974 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
5975 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
5976 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
5977 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09)
5978{
5979 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
5980 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
5981 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
5982 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
5983 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
5984 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
5985 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
5986 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
5987 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08),
5988 BSLS_COMPILERFEATURES_FORWARD(Args_09, args_09));
5989 int comparisonResult;
5990 BloombergLP::bslalg::RbTreeNode *insertLocation =
5991 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
5992 &comparisonResult,
5993 &d_tree,
5994 this->comparator(),
5995 static_cast<const Node *>(node)->value().first);
5996 if (!comparisonResult) {
5997 nodeFactory().deleteNode(node);
5998 return pair<iterator, bool>(iterator(insertLocation), false);
5999 }
6000
6001 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
6002 insertLocation,
6003 comparisonResult < 0,
6004 node);
6005 return pair<iterator, bool>(iterator(node), true);
6006}
6007#endif // BSLSTL_MAP_VARIADIC_LIMIT_F >= 9
6008
6009#if BSLSTL_MAP_VARIADIC_LIMIT_F >= 10
6010template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
6011template <class Args_01,
6012 class Args_02,
6013 class Args_03,
6014 class Args_04,
6015 class Args_05,
6016 class Args_06,
6017 class Args_07,
6018 class Args_08,
6019 class Args_09,
6020 class Args_10>
6021inline
6022pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
6023map<KEY, VALUE, COMPARATOR, ALLOCATOR>::emplace(
6024 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
6025 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
6026 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
6027 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
6028 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
6029 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
6030 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
6031 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
6032 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09,
6033 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) args_10)
6034{
6035 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
6036 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
6037 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
6038 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
6039 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
6040 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
6041 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
6042 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
6043 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08),
6044 BSLS_COMPILERFEATURES_FORWARD(Args_09, args_09),
6045 BSLS_COMPILERFEATURES_FORWARD(Args_10, args_10));
6046 int comparisonResult;
6047 BloombergLP::bslalg::RbTreeNode *insertLocation =
6048 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
6049 &comparisonResult,
6050 &d_tree,
6051 this->comparator(),
6052 static_cast<const Node *>(node)->value().first);
6053 if (!comparisonResult) {
6054 nodeFactory().deleteNode(node);
6055 return pair<iterator, bool>(iterator(insertLocation), false);
6056 }
6057
6058 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
6059 insertLocation,
6060 comparisonResult < 0,
6061 node);
6062 return pair<iterator, bool>(iterator(node), true);
6063}
6064#endif // BSLSTL_MAP_VARIADIC_LIMIT_F >= 10
6065
6066
6067#if BSLSTL_MAP_VARIADIC_LIMIT_F >= 0
6068template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
6069inline
6070typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
6071map<KEY, VALUE, COMPARATOR, ALLOCATOR>::emplace_hint(const_iterator hint)
6072{
6073 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
6074 );
6075 BloombergLP::bslalg::RbTreeNode *hintNode =
6076 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
6077 int comparisonResult;
6078 BloombergLP::bslalg::RbTreeNode *insertLocation =
6079 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
6080 &comparisonResult,
6081 &d_tree,
6082 this->comparator(),
6083 static_cast<const Node *>(node)->value().first,
6084 hintNode);
6085 if (!comparisonResult) {
6086 nodeFactory().deleteNode(node);
6087 return iterator(insertLocation);
6088 }
6089
6090 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
6091 insertLocation,
6092 comparisonResult < 0,
6093 node);
6094 return iterator(node);
6095}
6096#endif // BSLSTL_MAP_VARIADIC_LIMIT_F >= 0
6097
6098#if BSLSTL_MAP_VARIADIC_LIMIT_F >= 1
6099template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
6100template <class Args_01>
6101inline
6102typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
6103map<KEY, VALUE, COMPARATOR, ALLOCATOR>::emplace_hint(const_iterator hint,
6104 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01)
6105{
6106 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
6107 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01));
6108 BloombergLP::bslalg::RbTreeNode *hintNode =
6109 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
6110 int comparisonResult;
6111 BloombergLP::bslalg::RbTreeNode *insertLocation =
6112 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
6113 &comparisonResult,
6114 &d_tree,
6115 this->comparator(),
6116 static_cast<const Node *>(node)->value().first,
6117 hintNode);
6118 if (!comparisonResult) {
6119 nodeFactory().deleteNode(node);
6120 return iterator(insertLocation);
6121 }
6122
6123 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
6124 insertLocation,
6125 comparisonResult < 0,
6126 node);
6127 return iterator(node);
6128}
6129#endif // BSLSTL_MAP_VARIADIC_LIMIT_F >= 1
6130
6131#if BSLSTL_MAP_VARIADIC_LIMIT_F >= 2
6132template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
6133template <class Args_01,
6134 class Args_02>
6135inline
6136typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
6137map<KEY, VALUE, COMPARATOR, ALLOCATOR>::emplace_hint(const_iterator hint,
6138 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
6139 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02)
6140{
6141 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
6142 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
6143 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02));
6144 BloombergLP::bslalg::RbTreeNode *hintNode =
6145 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
6146 int comparisonResult;
6147 BloombergLP::bslalg::RbTreeNode *insertLocation =
6148 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
6149 &comparisonResult,
6150 &d_tree,
6151 this->comparator(),
6152 static_cast<const Node *>(node)->value().first,
6153 hintNode);
6154 if (!comparisonResult) {
6155 nodeFactory().deleteNode(node);
6156 return iterator(insertLocation);
6157 }
6158
6159 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
6160 insertLocation,
6161 comparisonResult < 0,
6162 node);
6163 return iterator(node);
6164}
6165#endif // BSLSTL_MAP_VARIADIC_LIMIT_F >= 2
6166
6167#if BSLSTL_MAP_VARIADIC_LIMIT_F >= 3
6168template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
6169template <class Args_01,
6170 class Args_02,
6171 class Args_03>
6172inline
6173typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
6174map<KEY, VALUE, COMPARATOR, ALLOCATOR>::emplace_hint(const_iterator hint,
6175 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
6176 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
6177 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03)
6178{
6179 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
6180 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
6181 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
6182 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03));
6183 BloombergLP::bslalg::RbTreeNode *hintNode =
6184 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
6185 int comparisonResult;
6186 BloombergLP::bslalg::RbTreeNode *insertLocation =
6187 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
6188 &comparisonResult,
6189 &d_tree,
6190 this->comparator(),
6191 static_cast<const Node *>(node)->value().first,
6192 hintNode);
6193 if (!comparisonResult) {
6194 nodeFactory().deleteNode(node);
6195 return iterator(insertLocation);
6196 }
6197
6198 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
6199 insertLocation,
6200 comparisonResult < 0,
6201 node);
6202 return iterator(node);
6203}
6204#endif // BSLSTL_MAP_VARIADIC_LIMIT_F >= 3
6205
6206#if BSLSTL_MAP_VARIADIC_LIMIT_F >= 4
6207template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
6208template <class Args_01,
6209 class Args_02,
6210 class Args_03,
6211 class Args_04>
6212inline
6213typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
6214map<KEY, VALUE, COMPARATOR, ALLOCATOR>::emplace_hint(const_iterator hint,
6215 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
6216 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
6217 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
6218 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04)
6219{
6220 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
6221 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
6222 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
6223 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
6224 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04));
6225 BloombergLP::bslalg::RbTreeNode *hintNode =
6226 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
6227 int comparisonResult;
6228 BloombergLP::bslalg::RbTreeNode *insertLocation =
6229 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
6230 &comparisonResult,
6231 &d_tree,
6232 this->comparator(),
6233 static_cast<const Node *>(node)->value().first,
6234 hintNode);
6235 if (!comparisonResult) {
6236 nodeFactory().deleteNode(node);
6237 return iterator(insertLocation);
6238 }
6239
6240 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
6241 insertLocation,
6242 comparisonResult < 0,
6243 node);
6244 return iterator(node);
6245}
6246#endif // BSLSTL_MAP_VARIADIC_LIMIT_F >= 4
6247
6248#if BSLSTL_MAP_VARIADIC_LIMIT_F >= 5
6249template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
6250template <class Args_01,
6251 class Args_02,
6252 class Args_03,
6253 class Args_04,
6254 class Args_05>
6255inline
6256typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
6257map<KEY, VALUE, COMPARATOR, ALLOCATOR>::emplace_hint(const_iterator hint,
6258 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
6259 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
6260 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
6261 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
6262 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05)
6263{
6264 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
6265 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
6266 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
6267 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
6268 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
6269 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05));
6270 BloombergLP::bslalg::RbTreeNode *hintNode =
6271 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
6272 int comparisonResult;
6273 BloombergLP::bslalg::RbTreeNode *insertLocation =
6274 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
6275 &comparisonResult,
6276 &d_tree,
6277 this->comparator(),
6278 static_cast<const Node *>(node)->value().first,
6279 hintNode);
6280 if (!comparisonResult) {
6281 nodeFactory().deleteNode(node);
6282 return iterator(insertLocation);
6283 }
6284
6285 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
6286 insertLocation,
6287 comparisonResult < 0,
6288 node);
6289 return iterator(node);
6290}
6291#endif // BSLSTL_MAP_VARIADIC_LIMIT_F >= 5
6292
6293#if BSLSTL_MAP_VARIADIC_LIMIT_F >= 6
6294template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
6295template <class Args_01,
6296 class Args_02,
6297 class Args_03,
6298 class Args_04,
6299 class Args_05,
6300 class Args_06>
6301inline
6302typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
6303map<KEY, VALUE, COMPARATOR, ALLOCATOR>::emplace_hint(const_iterator hint,
6304 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
6305 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
6306 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
6307 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
6308 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
6309 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06)
6310{
6311 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
6312 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
6313 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
6314 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
6315 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
6316 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
6317 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06));
6318 BloombergLP::bslalg::RbTreeNode *hintNode =
6319 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
6320 int comparisonResult;
6321 BloombergLP::bslalg::RbTreeNode *insertLocation =
6322 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
6323 &comparisonResult,
6324 &d_tree,
6325 this->comparator(),
6326 static_cast<const Node *>(node)->value().first,
6327 hintNode);
6328 if (!comparisonResult) {
6329 nodeFactory().deleteNode(node);
6330 return iterator(insertLocation);
6331 }
6332
6333 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
6334 insertLocation,
6335 comparisonResult < 0,
6336 node);
6337 return iterator(node);
6338}
6339#endif // BSLSTL_MAP_VARIADIC_LIMIT_F >= 6
6340
6341#if BSLSTL_MAP_VARIADIC_LIMIT_F >= 7
6342template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
6343template <class Args_01,
6344 class Args_02,
6345 class Args_03,
6346 class Args_04,
6347 class Args_05,
6348 class Args_06,
6349 class Args_07>
6350inline
6351typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
6352map<KEY, VALUE, COMPARATOR, ALLOCATOR>::emplace_hint(const_iterator hint,
6353 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
6354 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
6355 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
6356 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
6357 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
6358 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
6359 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07)
6360{
6361 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
6362 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
6363 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
6364 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
6365 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
6366 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
6367 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
6368 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07));
6369 BloombergLP::bslalg::RbTreeNode *hintNode =
6370 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
6371 int comparisonResult;
6372 BloombergLP::bslalg::RbTreeNode *insertLocation =
6373 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
6374 &comparisonResult,
6375 &d_tree,
6376 this->comparator(),
6377 static_cast<const Node *>(node)->value().first,
6378 hintNode);
6379 if (!comparisonResult) {
6380 nodeFactory().deleteNode(node);
6381 return iterator(insertLocation);
6382 }
6383
6384 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
6385 insertLocation,
6386 comparisonResult < 0,
6387 node);
6388 return iterator(node);
6389}
6390#endif // BSLSTL_MAP_VARIADIC_LIMIT_F >= 7
6391
6392#if BSLSTL_MAP_VARIADIC_LIMIT_F >= 8
6393template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
6394template <class Args_01,
6395 class Args_02,
6396 class Args_03,
6397 class Args_04,
6398 class Args_05,
6399 class Args_06,
6400 class Args_07,
6401 class Args_08>
6402inline
6403typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
6404map<KEY, VALUE, COMPARATOR, ALLOCATOR>::emplace_hint(const_iterator hint,
6405 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
6406 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
6407 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
6408 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
6409 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
6410 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
6411 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
6412 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08)
6413{
6414 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
6415 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
6416 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
6417 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
6418 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
6419 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
6420 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
6421 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
6422 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08));
6423 BloombergLP::bslalg::RbTreeNode *hintNode =
6424 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
6425 int comparisonResult;
6426 BloombergLP::bslalg::RbTreeNode *insertLocation =
6427 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
6428 &comparisonResult,
6429 &d_tree,
6430 this->comparator(),
6431 static_cast<const Node *>(node)->value().first,
6432 hintNode);
6433 if (!comparisonResult) {
6434 nodeFactory().deleteNode(node);
6435 return iterator(insertLocation);
6436 }
6437
6438 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
6439 insertLocation,
6440 comparisonResult < 0,
6441 node);
6442 return iterator(node);
6443}
6444#endif // BSLSTL_MAP_VARIADIC_LIMIT_F >= 8
6445
6446#if BSLSTL_MAP_VARIADIC_LIMIT_F >= 9
6447template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
6448template <class Args_01,
6449 class Args_02,
6450 class Args_03,
6451 class Args_04,
6452 class Args_05,
6453 class Args_06,
6454 class Args_07,
6455 class Args_08,
6456 class Args_09>
6457inline
6458typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
6459map<KEY, VALUE, COMPARATOR, ALLOCATOR>::emplace_hint(const_iterator hint,
6460 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
6461 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
6462 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
6463 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
6464 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
6465 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
6466 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
6467 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
6468 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09)
6469{
6470 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
6471 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
6472 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
6473 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
6474 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
6475 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
6476 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
6477 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
6478 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08),
6479 BSLS_COMPILERFEATURES_FORWARD(Args_09, args_09));
6480 BloombergLP::bslalg::RbTreeNode *hintNode =
6481 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
6482 int comparisonResult;
6483 BloombergLP::bslalg::RbTreeNode *insertLocation =
6484 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
6485 &comparisonResult,
6486 &d_tree,
6487 this->comparator(),
6488 static_cast<const Node *>(node)->value().first,
6489 hintNode);
6490 if (!comparisonResult) {
6491 nodeFactory().deleteNode(node);
6492 return iterator(insertLocation);
6493 }
6494
6495 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
6496 insertLocation,
6497 comparisonResult < 0,
6498 node);
6499 return iterator(node);
6500}
6501#endif // BSLSTL_MAP_VARIADIC_LIMIT_F >= 9
6502
6503#if BSLSTL_MAP_VARIADIC_LIMIT_F >= 10
6504template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
6505template <class Args_01,
6506 class Args_02,
6507 class Args_03,
6508 class Args_04,
6509 class Args_05,
6510 class Args_06,
6511 class Args_07,
6512 class Args_08,
6513 class Args_09,
6514 class Args_10>
6515inline
6516typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
6517map<KEY, VALUE, COMPARATOR, ALLOCATOR>::emplace_hint(const_iterator hint,
6518 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
6519 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
6520 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
6521 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
6522 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
6523 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
6524 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
6525 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
6526 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09,
6527 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) args_10)
6528{
6529 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
6530 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
6531 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
6532 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
6533 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
6534 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
6535 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
6536 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
6537 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08),
6538 BSLS_COMPILERFEATURES_FORWARD(Args_09, args_09),
6539 BSLS_COMPILERFEATURES_FORWARD(Args_10, args_10));
6540 BloombergLP::bslalg::RbTreeNode *hintNode =
6541 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
6542 int comparisonResult;
6543 BloombergLP::bslalg::RbTreeNode *insertLocation =
6544 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
6545 &comparisonResult,
6546 &d_tree,
6547 this->comparator(),
6548 static_cast<const Node *>(node)->value().first,
6549 hintNode);
6550 if (!comparisonResult) {
6551 nodeFactory().deleteNode(node);
6552 return iterator(insertLocation);
6553 }
6554
6555 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
6556 insertLocation,
6557 comparisonResult < 0,
6558 node);
6559 return iterator(node);
6560}
6561#endif // BSLSTL_MAP_VARIADIC_LIMIT_F >= 10
6562
6563#else
6564// The generated code below is a workaround for the absence of perfect
6565// forwarding in some compilers.
6566
6567template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
6568template <class... Args>
6569inline
6570pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
6571map<KEY, VALUE, COMPARATOR, ALLOCATOR>::emplace(
6573{
6574 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
6575 BSLS_COMPILERFEATURES_FORWARD(Args, args)...);
6576 int comparisonResult;
6577 BloombergLP::bslalg::RbTreeNode *insertLocation =
6578 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
6579 &comparisonResult,
6580 &d_tree,
6581 this->comparator(),
6582 static_cast<const Node *>(node)->value().first);
6583 if (!comparisonResult) {
6584 nodeFactory().deleteNode(node);
6585 return pair<iterator, bool>(iterator(insertLocation), false);
6586 }
6587
6588 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
6589 insertLocation,
6590 comparisonResult < 0,
6591 node);
6592 return pair<iterator, bool>(iterator(node), true);
6593}
6594
6595template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
6596template <class... Args>
6597inline
6598typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
6599map<KEY, VALUE, COMPARATOR, ALLOCATOR>::emplace_hint(const_iterator hint,
6601{
6602 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
6603 BSLS_COMPILERFEATURES_FORWARD(Args, args)...);
6604 BloombergLP::bslalg::RbTreeNode *hintNode =
6605 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
6606 int comparisonResult;
6607 BloombergLP::bslalg::RbTreeNode *insertLocation =
6608 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
6609 &comparisonResult,
6610 &d_tree,
6611 this->comparator(),
6612 static_cast<const Node *>(node)->value().first,
6613 hintNode);
6614 if (!comparisonResult) {
6615 nodeFactory().deleteNode(node);
6616 return iterator(insertLocation);
6617 }
6618
6619 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
6620 insertLocation,
6621 comparisonResult < 0,
6622 node);
6623 return iterator(node);
6624}
6625
6626// }}} END GENERATED CODE
6627#endif
6628
6629template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
6630inline
6631typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
6632map<KEY, VALUE, COMPARATOR, ALLOCATOR>::erase(const_iterator position)
6633{
6634 BSLS_ASSERT_SAFE(position != end());
6635
6636 BloombergLP::bslalg::RbTreeNode *node =
6637 const_cast<BloombergLP::bslalg::RbTreeNode *>(position.node());
6638 BloombergLP::bslalg::RbTreeNode *result =
6639 BloombergLP::bslalg::RbTreeUtil::next(node);
6640 BloombergLP::bslalg::RbTreeUtil::remove(&d_tree, node);
6641 nodeFactory().deleteNode(node);
6642 return iterator(result);
6643}
6644
6645template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
6646inline
6647typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
6648map<KEY, VALUE, COMPARATOR, ALLOCATOR>::erase(iterator position)
6649{
6650 return erase(const_iterator(position));
6651}
6652
6653template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
6654inline
6655typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::size_type
6656map<KEY, VALUE, COMPARATOR, ALLOCATOR>::erase(const key_type& key)
6657{
6658 const_iterator it = find(key);
6659 if (it == end()) {
6660 return 0; // RETURN
6661 }
6662 erase(it);
6663 return 1;
6664}
6665
6666template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
6667inline
6668typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
6669map<KEY, VALUE, COMPARATOR, ALLOCATOR>::erase(const_iterator first,
6670 const_iterator last)
6671{
6672 while (first != last) {
6673 first = erase(first);
6674 }
6675 return iterator(last.node());
6676}
6677
6678template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
6679inline
6680void map<KEY, VALUE, COMPARATOR, ALLOCATOR>::swap(map& other)
6682 AllocatorTraits::is_always_equal::value &&
6683 bsl::is_nothrow_swappable<COMPARATOR>::value)
6684{
6685 if (AllocatorTraits::propagate_on_container_swap::value) {
6686 quickSwapExchangeAllocators(other);
6687 }
6688 else {
6689 // C++11 behavior for member 'swap': undefined for unequal allocators.
6690 // BSLS_ASSERT(allocator() == other.allocator());
6691
6693 nodeFactory().allocator() == other.nodeFactory().allocator())) {
6694 quickSwapRetainAllocators(other);
6695 }
6696 else {
6698
6699 map toOtherCopy(MoveUtil::move(*this),
6700 other.nodeFactory().allocator());
6701 map toThisCopy(MoveUtil::move(other), nodeFactory().allocator());
6702
6703 this->quickSwapRetainAllocators(toThisCopy);
6704 other.quickSwapRetainAllocators(toOtherCopy);
6705 }
6706 }
6707}
6708
6709#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
6710// {{{ BEGIN GENERATED CODE
6711// Command line: sim_cpp11_features.pl bslstl_map.h
6712#ifndef BSLSTL_MAP_VARIADIC_LIMIT
6713#define BSLSTL_MAP_VARIADIC_LIMIT 10
6714#endif
6715#ifndef BSLSTL_MAP_VARIADIC_LIMIT_G
6716#define BSLSTL_MAP_VARIADIC_LIMIT_G BSLSTL_MAP_VARIADIC_LIMIT
6717#endif
6718#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 0
6719template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
6720inline
6721pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
6722map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(const key_type& key)
6723{
6724 int comparisonResult;
6725 BloombergLP::bslalg::RbTreeNode *insertLocation =
6726 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
6727 &comparisonResult,
6728 &d_tree,
6729 this->comparator(),
6730 key);
6731 if (!comparisonResult) {
6732 return pair<iterator, bool>(iterator(insertLocation), false);
6733 }
6734
6735#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
6736 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
6737 std::piecewise_construct,
6738 std::forward_as_tuple(key),
6739 std::forward_as_tuple());
6740#else
6741 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
6742 key,
6743 mapped_type());
6744#endif
6745
6746 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
6747 insertLocation,
6748 comparisonResult < 0,
6749 node);
6750 return pair<iterator, bool>(iterator(node), true);
6751}
6752#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 0
6753
6754#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 1
6755template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
6756template <class Args_01>
6757inline
6758pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
6759map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(const key_type& key,
6760 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01)
6761{
6762 int comparisonResult;
6763 BloombergLP::bslalg::RbTreeNode *insertLocation =
6764 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
6765 &comparisonResult,
6766 &d_tree,
6767 this->comparator(),
6768 key);
6769 if (!comparisonResult) {
6770 return pair<iterator, bool>(iterator(insertLocation), false);
6771 }
6772
6773#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
6774 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
6775 std::piecewise_construct,
6776 std::forward_as_tuple(key),
6777 std::forward_as_tuple(
6778 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01)));
6779#else
6780 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
6781 key,
6782 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01)));
6783#endif
6784
6785 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
6786 insertLocation,
6787 comparisonResult < 0,
6788 node);
6789 return pair<iterator, bool>(iterator(node), true);
6790}
6791#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 1
6792
6793#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 2
6794template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
6795template <class Args_01,
6796 class Args_02>
6797inline
6798pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
6799map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(const key_type& key,
6800 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
6801 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02)
6802{
6803 int comparisonResult;
6804 BloombergLP::bslalg::RbTreeNode *insertLocation =
6805 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
6806 &comparisonResult,
6807 &d_tree,
6808 this->comparator(),
6809 key);
6810 if (!comparisonResult) {
6811 return pair<iterator, bool>(iterator(insertLocation), false);
6812 }
6813
6814#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
6815 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
6816 std::piecewise_construct,
6817 std::forward_as_tuple(key),
6818 std::forward_as_tuple(
6819 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
6820 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02)));
6821#else
6822 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
6823 key,
6824 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
6825 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02)));
6826#endif
6827
6828 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
6829 insertLocation,
6830 comparisonResult < 0,
6831 node);
6832 return pair<iterator, bool>(iterator(node), true);
6833}
6834#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 2
6835
6836#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 3
6837template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
6838template <class Args_01,
6839 class Args_02,
6840 class Args_03>
6841inline
6842pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
6843map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(const key_type& key,
6844 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
6845 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
6846 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03)
6847{
6848 int comparisonResult;
6849 BloombergLP::bslalg::RbTreeNode *insertLocation =
6850 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
6851 &comparisonResult,
6852 &d_tree,
6853 this->comparator(),
6854 key);
6855 if (!comparisonResult) {
6856 return pair<iterator, bool>(iterator(insertLocation), false);
6857 }
6858
6859#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
6860 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
6861 std::piecewise_construct,
6862 std::forward_as_tuple(key),
6863 std::forward_as_tuple(
6864 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
6865 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
6866 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03)));
6867#else
6868 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
6869 key,
6870 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
6871 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
6872 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03)));
6873#endif
6874
6875 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
6876 insertLocation,
6877 comparisonResult < 0,
6878 node);
6879 return pair<iterator, bool>(iterator(node), true);
6880}
6881#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 3
6882
6883#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 4
6884template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
6885template <class Args_01,
6886 class Args_02,
6887 class Args_03,
6888 class Args_04>
6889inline
6890pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
6891map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(const key_type& key,
6892 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
6893 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
6894 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
6895 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04)
6896{
6897 int comparisonResult;
6898 BloombergLP::bslalg::RbTreeNode *insertLocation =
6899 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
6900 &comparisonResult,
6901 &d_tree,
6902 this->comparator(),
6903 key);
6904 if (!comparisonResult) {
6905 return pair<iterator, bool>(iterator(insertLocation), false);
6906 }
6907
6908#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
6909 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
6910 std::piecewise_construct,
6911 std::forward_as_tuple(key),
6912 std::forward_as_tuple(
6913 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
6914 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
6915 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
6916 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04)));
6917#else
6918 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
6919 key,
6920 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
6921 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
6922 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
6923 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04)));
6924#endif
6925
6926 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
6927 insertLocation,
6928 comparisonResult < 0,
6929 node);
6930 return pair<iterator, bool>(iterator(node), true);
6931}
6932#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 4
6933
6934#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 5
6935template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
6936template <class Args_01,
6937 class Args_02,
6938 class Args_03,
6939 class Args_04,
6940 class Args_05>
6941inline
6942pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
6943map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(const key_type& key,
6944 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
6945 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
6946 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
6947 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
6948 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05)
6949{
6950 int comparisonResult;
6951 BloombergLP::bslalg::RbTreeNode *insertLocation =
6952 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
6953 &comparisonResult,
6954 &d_tree,
6955 this->comparator(),
6956 key);
6957 if (!comparisonResult) {
6958 return pair<iterator, bool>(iterator(insertLocation), false);
6959 }
6960
6961#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
6962 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
6963 std::piecewise_construct,
6964 std::forward_as_tuple(key),
6965 std::forward_as_tuple(
6966 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
6967 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
6968 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
6969 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
6970 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05)));
6971#else
6972 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
6973 key,
6974 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
6975 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
6976 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
6977 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
6978 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05)));
6979#endif
6980
6981 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
6982 insertLocation,
6983 comparisonResult < 0,
6984 node);
6985 return pair<iterator, bool>(iterator(node), true);
6986}
6987#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 5
6988
6989#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 6
6990template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
6991template <class Args_01,
6992 class Args_02,
6993 class Args_03,
6994 class Args_04,
6995 class Args_05,
6996 class Args_06>
6997inline
6998pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
6999map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(const key_type& key,
7000 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
7001 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
7002 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
7003 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
7004 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
7005 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06)
7006{
7007 int comparisonResult;
7008 BloombergLP::bslalg::RbTreeNode *insertLocation =
7009 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
7010 &comparisonResult,
7011 &d_tree,
7012 this->comparator(),
7013 key);
7014 if (!comparisonResult) {
7015 return pair<iterator, bool>(iterator(insertLocation), false);
7016 }
7017
7018#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7019 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7020 std::piecewise_construct,
7021 std::forward_as_tuple(key),
7022 std::forward_as_tuple(
7023 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7024 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
7025 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
7026 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
7027 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
7028 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06)));
7029#else
7030 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7031 key,
7032 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7033 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
7034 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
7035 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
7036 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
7037 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06)));
7038#endif
7039
7040 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
7041 insertLocation,
7042 comparisonResult < 0,
7043 node);
7044 return pair<iterator, bool>(iterator(node), true);
7045}
7046#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 6
7047
7048#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 7
7049template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
7050template <class Args_01,
7051 class Args_02,
7052 class Args_03,
7053 class Args_04,
7054 class Args_05,
7055 class Args_06,
7056 class Args_07>
7057inline
7058pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
7059map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(const key_type& key,
7060 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
7061 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
7062 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
7063 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
7064 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
7065 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
7066 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07)
7067{
7068 int comparisonResult;
7069 BloombergLP::bslalg::RbTreeNode *insertLocation =
7070 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
7071 &comparisonResult,
7072 &d_tree,
7073 this->comparator(),
7074 key);
7075 if (!comparisonResult) {
7076 return pair<iterator, bool>(iterator(insertLocation), false);
7077 }
7078
7079#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7080 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7081 std::piecewise_construct,
7082 std::forward_as_tuple(key),
7083 std::forward_as_tuple(
7084 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7085 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
7086 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
7087 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
7088 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
7089 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
7090 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07)));
7091#else
7092 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7093 key,
7094 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7095 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
7096 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
7097 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
7098 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
7099 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
7100 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07)));
7101#endif
7102
7103 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
7104 insertLocation,
7105 comparisonResult < 0,
7106 node);
7107 return pair<iterator, bool>(iterator(node), true);
7108}
7109#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 7
7110
7111#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 8
7112template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
7113template <class Args_01,
7114 class Args_02,
7115 class Args_03,
7116 class Args_04,
7117 class Args_05,
7118 class Args_06,
7119 class Args_07,
7120 class Args_08>
7121inline
7122pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
7123map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(const key_type& key,
7124 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
7125 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
7126 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
7127 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
7128 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
7129 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
7130 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
7131 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08)
7132{
7133 int comparisonResult;
7134 BloombergLP::bslalg::RbTreeNode *insertLocation =
7135 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
7136 &comparisonResult,
7137 &d_tree,
7138 this->comparator(),
7139 key);
7140 if (!comparisonResult) {
7141 return pair<iterator, bool>(iterator(insertLocation), false);
7142 }
7143
7144#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7145 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7146 std::piecewise_construct,
7147 std::forward_as_tuple(key),
7148 std::forward_as_tuple(
7149 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7150 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
7151 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
7152 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
7153 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
7154 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
7155 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
7156 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08)));
7157#else
7158 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7159 key,
7160 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7161 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
7162 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
7163 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
7164 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
7165 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
7166 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
7167 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08)));
7168#endif
7169
7170 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
7171 insertLocation,
7172 comparisonResult < 0,
7173 node);
7174 return pair<iterator, bool>(iterator(node), true);
7175}
7176#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 8
7177
7178#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 9
7179template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
7180template <class Args_01,
7181 class Args_02,
7182 class Args_03,
7183 class Args_04,
7184 class Args_05,
7185 class Args_06,
7186 class Args_07,
7187 class Args_08,
7188 class Args_09>
7189inline
7190pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
7191map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(const key_type& key,
7192 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
7193 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
7194 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
7195 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
7196 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
7197 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
7198 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
7199 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
7200 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09)
7201{
7202 int comparisonResult;
7203 BloombergLP::bslalg::RbTreeNode *insertLocation =
7204 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
7205 &comparisonResult,
7206 &d_tree,
7207 this->comparator(),
7208 key);
7209 if (!comparisonResult) {
7210 return pair<iterator, bool>(iterator(insertLocation), false);
7211 }
7212
7213#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7214 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7215 std::piecewise_construct,
7216 std::forward_as_tuple(key),
7217 std::forward_as_tuple(
7218 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7219 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
7220 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
7221 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
7222 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
7223 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
7224 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
7225 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08),
7226 BSLS_COMPILERFEATURES_FORWARD(Args_09, args_09)));
7227#else
7228 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7229 key,
7230 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7231 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
7232 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
7233 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
7234 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
7235 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
7236 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
7237 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08),
7238 BSLS_COMPILERFEATURES_FORWARD(Args_09, args_09)));
7239#endif
7240
7241 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
7242 insertLocation,
7243 comparisonResult < 0,
7244 node);
7245 return pair<iterator, bool>(iterator(node), true);
7246}
7247#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 9
7248
7249#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 10
7250template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
7251template <class Args_01,
7252 class Args_02,
7253 class Args_03,
7254 class Args_04,
7255 class Args_05,
7256 class Args_06,
7257 class Args_07,
7258 class Args_08,
7259 class Args_09,
7260 class Args_10>
7261inline
7262pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
7263map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(const key_type& key,
7264 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
7265 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
7266 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
7267 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
7268 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
7269 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
7270 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
7271 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
7272 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09,
7273 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) args_10)
7274{
7275 int comparisonResult;
7276 BloombergLP::bslalg::RbTreeNode *insertLocation =
7277 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
7278 &comparisonResult,
7279 &d_tree,
7280 this->comparator(),
7281 key);
7282 if (!comparisonResult) {
7283 return pair<iterator, bool>(iterator(insertLocation), false);
7284 }
7285
7286#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7287 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7288 std::piecewise_construct,
7289 std::forward_as_tuple(key),
7290 std::forward_as_tuple(
7291 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7292 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
7293 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
7294 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
7295 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
7296 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
7297 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
7298 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08),
7299 BSLS_COMPILERFEATURES_FORWARD(Args_09, args_09),
7300 BSLS_COMPILERFEATURES_FORWARD(Args_10, args_10)));
7301#else
7302 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7303 key,
7304 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7305 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
7306 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
7307 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
7308 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
7309 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
7310 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
7311 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08),
7312 BSLS_COMPILERFEATURES_FORWARD(Args_09, args_09),
7313 BSLS_COMPILERFEATURES_FORWARD(Args_10, args_10)));
7314#endif
7315
7316 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
7317 insertLocation,
7318 comparisonResult < 0,
7319 node);
7320 return pair<iterator, bool>(iterator(node), true);
7321}
7322#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 10
7323
7324
7325#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 0
7326template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
7327inline
7328typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
7329map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(const_iterator hint,
7330 const key_type& key)
7331{
7332 BloombergLP::bslalg::RbTreeNode *hintNode =
7333 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
7334 int comparisonResult;
7335 BloombergLP::bslalg::RbTreeNode *insertLocation =
7336 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
7337 &comparisonResult,
7338 &d_tree,
7339 this->comparator(),
7340 key,
7341 hintNode);
7342 if (!comparisonResult) {
7343 return iterator(insertLocation);
7344 }
7345
7346#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7347 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7348 std::piecewise_construct,
7349 std::forward_as_tuple(key),
7350 std::forward_as_tuple());
7351#else
7352 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7353 key,
7354 mapped_type());
7355#endif
7356
7357 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
7358 insertLocation,
7359 comparisonResult < 0,
7360 node);
7361 return iterator(node);
7362}
7363#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 0
7364
7365#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 1
7366template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
7367template <class Args_01>
7368inline
7369typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
7370map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(const_iterator hint,
7371 const key_type& key,
7372 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01)
7373{
7374 BloombergLP::bslalg::RbTreeNode *hintNode =
7375 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
7376 int comparisonResult;
7377 BloombergLP::bslalg::RbTreeNode *insertLocation =
7378 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
7379 &comparisonResult,
7380 &d_tree,
7381 this->comparator(),
7382 key,
7383 hintNode);
7384 if (!comparisonResult) {
7385 return iterator(insertLocation);
7386 }
7387
7388#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7389 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7390 std::piecewise_construct,
7391 std::forward_as_tuple(key),
7392 std::forward_as_tuple(
7393 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01)));
7394#else
7395 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7396 key,
7397 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01)));
7398#endif
7399
7400 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
7401 insertLocation,
7402 comparisonResult < 0,
7403 node);
7404 return iterator(node);
7405}
7406#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 1
7407
7408#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 2
7409template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
7410template <class Args_01,
7411 class Args_02>
7412inline
7413typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
7414map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(const_iterator hint,
7415 const key_type& key,
7416 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
7417 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02)
7418{
7419 BloombergLP::bslalg::RbTreeNode *hintNode =
7420 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
7421 int comparisonResult;
7422 BloombergLP::bslalg::RbTreeNode *insertLocation =
7423 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
7424 &comparisonResult,
7425 &d_tree,
7426 this->comparator(),
7427 key,
7428 hintNode);
7429 if (!comparisonResult) {
7430 return iterator(insertLocation);
7431 }
7432
7433#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7434 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7435 std::piecewise_construct,
7436 std::forward_as_tuple(key),
7437 std::forward_as_tuple(
7438 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7439 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02)));
7440#else
7441 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7442 key,
7443 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7444 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02)));
7445#endif
7446
7447 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
7448 insertLocation,
7449 comparisonResult < 0,
7450 node);
7451 return iterator(node);
7452}
7453#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 2
7454
7455#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 3
7456template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
7457template <class Args_01,
7458 class Args_02,
7459 class Args_03>
7460inline
7461typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
7462map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(const_iterator hint,
7463 const key_type& key,
7464 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
7465 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
7466 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03)
7467{
7468 BloombergLP::bslalg::RbTreeNode *hintNode =
7469 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
7470 int comparisonResult;
7471 BloombergLP::bslalg::RbTreeNode *insertLocation =
7472 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
7473 &comparisonResult,
7474 &d_tree,
7475 this->comparator(),
7476 key,
7477 hintNode);
7478 if (!comparisonResult) {
7479 return iterator(insertLocation);
7480 }
7481
7482#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7483 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7484 std::piecewise_construct,
7485 std::forward_as_tuple(key),
7486 std::forward_as_tuple(
7487 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7488 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
7489 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03)));
7490#else
7491 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7492 key,
7493 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7494 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
7495 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03)));
7496#endif
7497
7498 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
7499 insertLocation,
7500 comparisonResult < 0,
7501 node);
7502 return iterator(node);
7503}
7504#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 3
7505
7506#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 4
7507template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
7508template <class Args_01,
7509 class Args_02,
7510 class Args_03,
7511 class Args_04>
7512inline
7513typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
7514map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(const_iterator hint,
7515 const key_type& key,
7516 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
7517 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
7518 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
7519 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04)
7520{
7521 BloombergLP::bslalg::RbTreeNode *hintNode =
7522 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
7523 int comparisonResult;
7524 BloombergLP::bslalg::RbTreeNode *insertLocation =
7525 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
7526 &comparisonResult,
7527 &d_tree,
7528 this->comparator(),
7529 key,
7530 hintNode);
7531 if (!comparisonResult) {
7532 return iterator(insertLocation);
7533 }
7534
7535#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7536 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7537 std::piecewise_construct,
7538 std::forward_as_tuple(key),
7539 std::forward_as_tuple(
7540 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7541 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
7542 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
7543 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04)));
7544#else
7545 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7546 key,
7547 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7548 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
7549 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
7550 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04)));
7551#endif
7552
7553 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
7554 insertLocation,
7555 comparisonResult < 0,
7556 node);
7557 return iterator(node);
7558}
7559#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 4
7560
7561#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 5
7562template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
7563template <class Args_01,
7564 class Args_02,
7565 class Args_03,
7566 class Args_04,
7567 class Args_05>
7568inline
7569typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
7570map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(const_iterator hint,
7571 const key_type& key,
7572 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
7573 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
7574 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
7575 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
7576 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05)
7577{
7578 BloombergLP::bslalg::RbTreeNode *hintNode =
7579 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
7580 int comparisonResult;
7581 BloombergLP::bslalg::RbTreeNode *insertLocation =
7582 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
7583 &comparisonResult,
7584 &d_tree,
7585 this->comparator(),
7586 key,
7587 hintNode);
7588 if (!comparisonResult) {
7589 return iterator(insertLocation);
7590 }
7591
7592#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7593 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7594 std::piecewise_construct,
7595 std::forward_as_tuple(key),
7596 std::forward_as_tuple(
7597 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7598 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
7599 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
7600 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
7601 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05)));
7602#else
7603 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7604 key,
7605 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7606 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
7607 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
7608 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
7609 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05)));
7610#endif
7611
7612 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
7613 insertLocation,
7614 comparisonResult < 0,
7615 node);
7616 return iterator(node);
7617}
7618#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 5
7619
7620#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 6
7621template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
7622template <class Args_01,
7623 class Args_02,
7624 class Args_03,
7625 class Args_04,
7626 class Args_05,
7627 class Args_06>
7628inline
7629typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
7630map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(const_iterator hint,
7631 const key_type& key,
7632 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
7633 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
7634 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
7635 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
7636 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
7637 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06)
7638{
7639 BloombergLP::bslalg::RbTreeNode *hintNode =
7640 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
7641 int comparisonResult;
7642 BloombergLP::bslalg::RbTreeNode *insertLocation =
7643 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
7644 &comparisonResult,
7645 &d_tree,
7646 this->comparator(),
7647 key,
7648 hintNode);
7649 if (!comparisonResult) {
7650 return iterator(insertLocation);
7651 }
7652
7653#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7654 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7655 std::piecewise_construct,
7656 std::forward_as_tuple(key),
7657 std::forward_as_tuple(
7658 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7659 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
7660 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
7661 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
7662 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
7663 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06)));
7664#else
7665 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7666 key,
7667 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7668 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
7669 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
7670 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
7671 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
7672 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06)));
7673#endif
7674
7675 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
7676 insertLocation,
7677 comparisonResult < 0,
7678 node);
7679 return iterator(node);
7680}
7681#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 6
7682
7683#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 7
7684template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
7685template <class Args_01,
7686 class Args_02,
7687 class Args_03,
7688 class Args_04,
7689 class Args_05,
7690 class Args_06,
7691 class Args_07>
7692inline
7693typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
7694map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(const_iterator hint,
7695 const key_type& key,
7696 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
7697 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
7698 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
7699 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
7700 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
7701 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
7702 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07)
7703{
7704 BloombergLP::bslalg::RbTreeNode *hintNode =
7705 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
7706 int comparisonResult;
7707 BloombergLP::bslalg::RbTreeNode *insertLocation =
7708 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
7709 &comparisonResult,
7710 &d_tree,
7711 this->comparator(),
7712 key,
7713 hintNode);
7714 if (!comparisonResult) {
7715 return iterator(insertLocation);
7716 }
7717
7718#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7719 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7720 std::piecewise_construct,
7721 std::forward_as_tuple(key),
7722 std::forward_as_tuple(
7723 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7724 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
7725 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
7726 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
7727 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
7728 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
7729 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07)));
7730#else
7731 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7732 key,
7733 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7734 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
7735 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
7736 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
7737 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
7738 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
7739 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07)));
7740#endif
7741
7742 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
7743 insertLocation,
7744 comparisonResult < 0,
7745 node);
7746 return iterator(node);
7747}
7748#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 7
7749
7750#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 8
7751template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
7752template <class Args_01,
7753 class Args_02,
7754 class Args_03,
7755 class Args_04,
7756 class Args_05,
7757 class Args_06,
7758 class Args_07,
7759 class Args_08>
7760inline
7761typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
7762map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(const_iterator hint,
7763 const key_type& key,
7764 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
7765 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
7766 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
7767 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
7768 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
7769 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
7770 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
7771 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08)
7772{
7773 BloombergLP::bslalg::RbTreeNode *hintNode =
7774 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
7775 int comparisonResult;
7776 BloombergLP::bslalg::RbTreeNode *insertLocation =
7777 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
7778 &comparisonResult,
7779 &d_tree,
7780 this->comparator(),
7781 key,
7782 hintNode);
7783 if (!comparisonResult) {
7784 return iterator(insertLocation);
7785 }
7786
7787#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7788 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7789 std::piecewise_construct,
7790 std::forward_as_tuple(key),
7791 std::forward_as_tuple(
7792 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7793 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
7794 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
7795 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
7796 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
7797 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
7798 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
7799 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08)));
7800#else
7801 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7802 key,
7803 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7804 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
7805 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
7806 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
7807 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
7808 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
7809 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
7810 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08)));
7811#endif
7812
7813 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
7814 insertLocation,
7815 comparisonResult < 0,
7816 node);
7817 return iterator(node);
7818}
7819#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 8
7820
7821#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 9
7822template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
7823template <class Args_01,
7824 class Args_02,
7825 class Args_03,
7826 class Args_04,
7827 class Args_05,
7828 class Args_06,
7829 class Args_07,
7830 class Args_08,
7831 class Args_09>
7832inline
7833typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
7834map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(const_iterator hint,
7835 const key_type& key,
7836 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
7837 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
7838 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
7839 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
7840 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
7841 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
7842 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
7843 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
7844 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09)
7845{
7846 BloombergLP::bslalg::RbTreeNode *hintNode =
7847 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
7848 int comparisonResult;
7849 BloombergLP::bslalg::RbTreeNode *insertLocation =
7850 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
7851 &comparisonResult,
7852 &d_tree,
7853 this->comparator(),
7854 key,
7855 hintNode);
7856 if (!comparisonResult) {
7857 return iterator(insertLocation);
7858 }
7859
7860#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7861 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7862 std::piecewise_construct,
7863 std::forward_as_tuple(key),
7864 std::forward_as_tuple(
7865 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7866 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
7867 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
7868 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
7869 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
7870 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
7871 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
7872 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08),
7873 BSLS_COMPILERFEATURES_FORWARD(Args_09, args_09)));
7874#else
7875 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7876 key,
7877 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7878 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
7879 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
7880 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
7881 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
7882 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
7883 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
7884 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08),
7885 BSLS_COMPILERFEATURES_FORWARD(Args_09, args_09)));
7886#endif
7887
7888 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
7889 insertLocation,
7890 comparisonResult < 0,
7891 node);
7892 return iterator(node);
7893}
7894#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 9
7895
7896#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 10
7897template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
7898template <class Args_01,
7899 class Args_02,
7900 class Args_03,
7901 class Args_04,
7902 class Args_05,
7903 class Args_06,
7904 class Args_07,
7905 class Args_08,
7906 class Args_09,
7907 class Args_10>
7908inline
7909typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
7910map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(const_iterator hint,
7911 const key_type& key,
7912 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
7913 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
7914 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
7915 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
7916 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
7917 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
7918 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
7919 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
7920 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09,
7921 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) args_10)
7922{
7923 BloombergLP::bslalg::RbTreeNode *hintNode =
7924 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
7925 int comparisonResult;
7926 BloombergLP::bslalg::RbTreeNode *insertLocation =
7927 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
7928 &comparisonResult,
7929 &d_tree,
7930 this->comparator(),
7931 key,
7932 hintNode);
7933 if (!comparisonResult) {
7934 return iterator(insertLocation);
7935 }
7936
7937#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7938 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7939 std::piecewise_construct,
7940 std::forward_as_tuple(key),
7941 std::forward_as_tuple(
7942 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7943 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
7944 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
7945 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
7946 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
7947 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
7948 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
7949 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08),
7950 BSLS_COMPILERFEATURES_FORWARD(Args_09, args_09),
7951 BSLS_COMPILERFEATURES_FORWARD(Args_10, args_10)));
7952#else
7953 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7954 key,
7955 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
7956 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
7957 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
7958 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
7959 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
7960 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
7961 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
7962 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08),
7963 BSLS_COMPILERFEATURES_FORWARD(Args_09, args_09),
7964 BSLS_COMPILERFEATURES_FORWARD(Args_10, args_10)));
7965#endif
7966
7967 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
7968 insertLocation,
7969 comparisonResult < 0,
7970 node);
7971 return iterator(node);
7972}
7973#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 10
7974
7975
7976#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 0
7977template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
7978inline
7979pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
7980map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(
7981 BloombergLP::bslmf::MovableRef<key_type> key)
7982{
7983 key_type& lvalue = key;
7984
7985 int comparisonResult;
7986 BloombergLP::bslalg::RbTreeNode *insertLocation =
7987 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
7988 &comparisonResult,
7989 &d_tree,
7990 this->comparator(),
7991 lvalue);
7992 if (!comparisonResult) {
7993 return pair<iterator, bool>(iterator(insertLocation), false);
7994 }
7995
7996#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
7997 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
7998 std::piecewise_construct,
7999 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(key_type, key)),
8000 std::forward_as_tuple());
8001#else
8002 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8003 BSLS_COMPILERFEATURES_FORWARD(key_type, key),
8004 mapped_type());
8005#endif
8006
8007 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
8008 insertLocation,
8009 comparisonResult < 0,
8010 node);
8011
8012 return pair<iterator, bool>(iterator(node), true);
8013}
8014#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 0
8015
8016#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 1
8017template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
8018template <class Args_01>
8019inline
8020pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
8021map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(
8022 BloombergLP::bslmf::MovableRef<key_type> key,
8023 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01)
8024{
8025 key_type& lvalue = key;
8026
8027 int comparisonResult;
8028 BloombergLP::bslalg::RbTreeNode *insertLocation =
8029 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
8030 &comparisonResult,
8031 &d_tree,
8032 this->comparator(),
8033 lvalue);
8034 if (!comparisonResult) {
8035 return pair<iterator, bool>(iterator(insertLocation), false);
8036 }
8037
8038#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8039 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8040 std::piecewise_construct,
8041 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(key_type, key)),
8042 std::forward_as_tuple(
8043 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01)));
8044#else
8045 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8046 BSLS_COMPILERFEATURES_FORWARD(key_type, key),
8047 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01)));
8048#endif
8049
8050 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
8051 insertLocation,
8052 comparisonResult < 0,
8053 node);
8054
8055 return pair<iterator, bool>(iterator(node), true);
8056}
8057#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 1
8058
8059#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 2
8060template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
8061template <class Args_01,
8062 class Args_02>
8063inline
8064pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
8065map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(
8066 BloombergLP::bslmf::MovableRef<key_type> key,
8067 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
8068 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02)
8069{
8070 key_type& lvalue = key;
8071
8072 int comparisonResult;
8073 BloombergLP::bslalg::RbTreeNode *insertLocation =
8074 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
8075 &comparisonResult,
8076 &d_tree,
8077 this->comparator(),
8078 lvalue);
8079 if (!comparisonResult) {
8080 return pair<iterator, bool>(iterator(insertLocation), false);
8081 }
8082
8083#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8084 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8085 std::piecewise_construct,
8086 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(key_type, key)),
8087 std::forward_as_tuple(
8088 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8089 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02)));
8090#else
8091 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8092 BSLS_COMPILERFEATURES_FORWARD(key_type, key),
8093 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8094 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02)));
8095#endif
8096
8097 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
8098 insertLocation,
8099 comparisonResult < 0,
8100 node);
8101
8102 return pair<iterator, bool>(iterator(node), true);
8103}
8104#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 2
8105
8106#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 3
8107template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
8108template <class Args_01,
8109 class Args_02,
8110 class Args_03>
8111inline
8112pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
8113map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(
8114 BloombergLP::bslmf::MovableRef<key_type> key,
8115 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
8116 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
8117 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03)
8118{
8119 key_type& lvalue = key;
8120
8121 int comparisonResult;
8122 BloombergLP::bslalg::RbTreeNode *insertLocation =
8123 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
8124 &comparisonResult,
8125 &d_tree,
8126 this->comparator(),
8127 lvalue);
8128 if (!comparisonResult) {
8129 return pair<iterator, bool>(iterator(insertLocation), false);
8130 }
8131
8132#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8133 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8134 std::piecewise_construct,
8135 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(key_type, key)),
8136 std::forward_as_tuple(
8137 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8138 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
8139 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03)));
8140#else
8141 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8142 BSLS_COMPILERFEATURES_FORWARD(key_type, key),
8143 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8144 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
8145 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03)));
8146#endif
8147
8148 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
8149 insertLocation,
8150 comparisonResult < 0,
8151 node);
8152
8153 return pair<iterator, bool>(iterator(node), true);
8154}
8155#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 3
8156
8157#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 4
8158template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
8159template <class Args_01,
8160 class Args_02,
8161 class Args_03,
8162 class Args_04>
8163inline
8164pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
8165map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(
8166 BloombergLP::bslmf::MovableRef<key_type> key,
8167 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
8168 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
8169 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
8170 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04)
8171{
8172 key_type& lvalue = key;
8173
8174 int comparisonResult;
8175 BloombergLP::bslalg::RbTreeNode *insertLocation =
8176 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
8177 &comparisonResult,
8178 &d_tree,
8179 this->comparator(),
8180 lvalue);
8181 if (!comparisonResult) {
8182 return pair<iterator, bool>(iterator(insertLocation), false);
8183 }
8184
8185#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8186 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8187 std::piecewise_construct,
8188 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(key_type, key)),
8189 std::forward_as_tuple(
8190 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8191 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
8192 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
8193 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04)));
8194#else
8195 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8196 BSLS_COMPILERFEATURES_FORWARD(key_type, key),
8197 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8198 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
8199 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
8200 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04)));
8201#endif
8202
8203 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
8204 insertLocation,
8205 comparisonResult < 0,
8206 node);
8207
8208 return pair<iterator, bool>(iterator(node), true);
8209}
8210#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 4
8211
8212#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 5
8213template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
8214template <class Args_01,
8215 class Args_02,
8216 class Args_03,
8217 class Args_04,
8218 class Args_05>
8219inline
8220pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
8221map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(
8222 BloombergLP::bslmf::MovableRef<key_type> key,
8223 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
8224 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
8225 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
8226 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
8227 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05)
8228{
8229 key_type& lvalue = key;
8230
8231 int comparisonResult;
8232 BloombergLP::bslalg::RbTreeNode *insertLocation =
8233 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
8234 &comparisonResult,
8235 &d_tree,
8236 this->comparator(),
8237 lvalue);
8238 if (!comparisonResult) {
8239 return pair<iterator, bool>(iterator(insertLocation), false);
8240 }
8241
8242#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8243 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8244 std::piecewise_construct,
8245 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(key_type, key)),
8246 std::forward_as_tuple(
8247 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8248 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
8249 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
8250 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
8251 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05)));
8252#else
8253 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8254 BSLS_COMPILERFEATURES_FORWARD(key_type, key),
8255 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8256 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
8257 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
8258 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
8259 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05)));
8260#endif
8261
8262 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
8263 insertLocation,
8264 comparisonResult < 0,
8265 node);
8266
8267 return pair<iterator, bool>(iterator(node), true);
8268}
8269#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 5
8270
8271#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 6
8272template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
8273template <class Args_01,
8274 class Args_02,
8275 class Args_03,
8276 class Args_04,
8277 class Args_05,
8278 class Args_06>
8279inline
8280pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
8281map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(
8282 BloombergLP::bslmf::MovableRef<key_type> key,
8283 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
8284 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
8285 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
8286 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
8287 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
8288 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06)
8289{
8290 key_type& lvalue = key;
8291
8292 int comparisonResult;
8293 BloombergLP::bslalg::RbTreeNode *insertLocation =
8294 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
8295 &comparisonResult,
8296 &d_tree,
8297 this->comparator(),
8298 lvalue);
8299 if (!comparisonResult) {
8300 return pair<iterator, bool>(iterator(insertLocation), false);
8301 }
8302
8303#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8304 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8305 std::piecewise_construct,
8306 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(key_type, key)),
8307 std::forward_as_tuple(
8308 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8309 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
8310 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
8311 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
8312 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
8313 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06)));
8314#else
8315 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8316 BSLS_COMPILERFEATURES_FORWARD(key_type, key),
8317 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8318 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
8319 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
8320 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
8321 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
8322 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06)));
8323#endif
8324
8325 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
8326 insertLocation,
8327 comparisonResult < 0,
8328 node);
8329
8330 return pair<iterator, bool>(iterator(node), true);
8331}
8332#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 6
8333
8334#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 7
8335template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
8336template <class Args_01,
8337 class Args_02,
8338 class Args_03,
8339 class Args_04,
8340 class Args_05,
8341 class Args_06,
8342 class Args_07>
8343inline
8344pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
8345map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(
8346 BloombergLP::bslmf::MovableRef<key_type> key,
8347 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
8348 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
8349 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
8350 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
8351 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
8352 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
8353 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07)
8354{
8355 key_type& lvalue = key;
8356
8357 int comparisonResult;
8358 BloombergLP::bslalg::RbTreeNode *insertLocation =
8359 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
8360 &comparisonResult,
8361 &d_tree,
8362 this->comparator(),
8363 lvalue);
8364 if (!comparisonResult) {
8365 return pair<iterator, bool>(iterator(insertLocation), false);
8366 }
8367
8368#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8369 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8370 std::piecewise_construct,
8371 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(key_type, key)),
8372 std::forward_as_tuple(
8373 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8374 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
8375 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
8376 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
8377 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
8378 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
8379 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07)));
8380#else
8381 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8382 BSLS_COMPILERFEATURES_FORWARD(key_type, key),
8383 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8384 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
8385 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
8386 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
8387 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
8388 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
8389 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07)));
8390#endif
8391
8392 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
8393 insertLocation,
8394 comparisonResult < 0,
8395 node);
8396
8397 return pair<iterator, bool>(iterator(node), true);
8398}
8399#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 7
8400
8401#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 8
8402template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
8403template <class Args_01,
8404 class Args_02,
8405 class Args_03,
8406 class Args_04,
8407 class Args_05,
8408 class Args_06,
8409 class Args_07,
8410 class Args_08>
8411inline
8412pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
8413map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(
8414 BloombergLP::bslmf::MovableRef<key_type> key,
8415 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
8416 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
8417 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
8418 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
8419 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
8420 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
8421 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
8422 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08)
8423{
8424 key_type& lvalue = key;
8425
8426 int comparisonResult;
8427 BloombergLP::bslalg::RbTreeNode *insertLocation =
8428 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
8429 &comparisonResult,
8430 &d_tree,
8431 this->comparator(),
8432 lvalue);
8433 if (!comparisonResult) {
8434 return pair<iterator, bool>(iterator(insertLocation), false);
8435 }
8436
8437#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8438 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8439 std::piecewise_construct,
8440 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(key_type, key)),
8441 std::forward_as_tuple(
8442 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8443 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
8444 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
8445 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
8446 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
8447 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
8448 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
8449 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08)));
8450#else
8451 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8452 BSLS_COMPILERFEATURES_FORWARD(key_type, key),
8453 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8454 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
8455 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
8456 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
8457 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
8458 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
8459 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
8460 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08)));
8461#endif
8462
8463 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
8464 insertLocation,
8465 comparisonResult < 0,
8466 node);
8467
8468 return pair<iterator, bool>(iterator(node), true);
8469}
8470#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 8
8471
8472#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 9
8473template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
8474template <class Args_01,
8475 class Args_02,
8476 class Args_03,
8477 class Args_04,
8478 class Args_05,
8479 class Args_06,
8480 class Args_07,
8481 class Args_08,
8482 class Args_09>
8483inline
8484pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
8485map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(
8486 BloombergLP::bslmf::MovableRef<key_type> key,
8487 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
8488 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
8489 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
8490 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
8491 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
8492 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
8493 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
8494 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
8495 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09)
8496{
8497 key_type& lvalue = key;
8498
8499 int comparisonResult;
8500 BloombergLP::bslalg::RbTreeNode *insertLocation =
8501 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
8502 &comparisonResult,
8503 &d_tree,
8504 this->comparator(),
8505 lvalue);
8506 if (!comparisonResult) {
8507 return pair<iterator, bool>(iterator(insertLocation), false);
8508 }
8509
8510#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8511 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8512 std::piecewise_construct,
8513 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(key_type, key)),
8514 std::forward_as_tuple(
8515 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8516 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
8517 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
8518 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
8519 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
8520 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
8521 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
8522 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08),
8523 BSLS_COMPILERFEATURES_FORWARD(Args_09, args_09)));
8524#else
8525 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8526 BSLS_COMPILERFEATURES_FORWARD(key_type, key),
8527 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8528 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
8529 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
8530 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
8531 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
8532 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
8533 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
8534 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08),
8535 BSLS_COMPILERFEATURES_FORWARD(Args_09, args_09)));
8536#endif
8537
8538 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
8539 insertLocation,
8540 comparisonResult < 0,
8541 node);
8542
8543 return pair<iterator, bool>(iterator(node), true);
8544}
8545#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 9
8546
8547#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 10
8548template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
8549template <class Args_01,
8550 class Args_02,
8551 class Args_03,
8552 class Args_04,
8553 class Args_05,
8554 class Args_06,
8555 class Args_07,
8556 class Args_08,
8557 class Args_09,
8558 class Args_10>
8559inline
8560pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
8561map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(
8562 BloombergLP::bslmf::MovableRef<key_type> key,
8563 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
8564 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
8565 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
8566 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
8567 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
8568 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
8569 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
8570 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
8571 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09,
8572 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) args_10)
8573{
8574 key_type& lvalue = key;
8575
8576 int comparisonResult;
8577 BloombergLP::bslalg::RbTreeNode *insertLocation =
8578 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
8579 &comparisonResult,
8580 &d_tree,
8581 this->comparator(),
8582 lvalue);
8583 if (!comparisonResult) {
8584 return pair<iterator, bool>(iterator(insertLocation), false);
8585 }
8586
8587#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8588 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8589 std::piecewise_construct,
8590 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(key_type, key)),
8591 std::forward_as_tuple(
8592 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8593 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
8594 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
8595 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
8596 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
8597 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
8598 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
8599 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08),
8600 BSLS_COMPILERFEATURES_FORWARD(Args_09, args_09),
8601 BSLS_COMPILERFEATURES_FORWARD(Args_10, args_10)));
8602#else
8603 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8604 BSLS_COMPILERFEATURES_FORWARD(key_type, key),
8605 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8606 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
8607 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
8608 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
8609 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
8610 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
8611 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
8612 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08),
8613 BSLS_COMPILERFEATURES_FORWARD(Args_09, args_09),
8614 BSLS_COMPILERFEATURES_FORWARD(Args_10, args_10)));
8615#endif
8616
8617 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
8618 insertLocation,
8619 comparisonResult < 0,
8620 node);
8621
8622 return pair<iterator, bool>(iterator(node), true);
8623}
8624#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 10
8625
8626
8627#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 0
8628template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
8629inline
8630typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
8631map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(
8632 const_iterator hint,
8633 BloombergLP::bslmf::MovableRef<key_type> key)
8634{
8635 key_type& lvalue = key;
8636
8637 BloombergLP::bslalg::RbTreeNode *hintNode =
8638 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
8639 int comparisonResult;
8640 BloombergLP::bslalg::RbTreeNode *insertLocation =
8641 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
8642 &comparisonResult,
8643 &d_tree,
8644 this->comparator(),
8645 lvalue,
8646 hintNode);
8647 if (!comparisonResult) {
8648 return iterator(insertLocation);
8649 }
8650
8651#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8652 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8653 std::piecewise_construct,
8654 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(key_type, key)),
8655 std::forward_as_tuple());
8656#else
8657 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8658 BSLS_COMPILERFEATURES_FORWARD(key_type, key),
8659 mapped_type());
8660#endif
8661
8662 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
8663 insertLocation,
8664 comparisonResult < 0,
8665 node);
8666 return iterator(node);
8667}
8668#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 0
8669
8670#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 1
8671template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
8672template <class Args_01>
8673inline
8674typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
8675map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(
8676 const_iterator hint,
8677 BloombergLP::bslmf::MovableRef<key_type> key,
8678 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01)
8679{
8680 key_type& lvalue = key;
8681
8682 BloombergLP::bslalg::RbTreeNode *hintNode =
8683 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
8684 int comparisonResult;
8685 BloombergLP::bslalg::RbTreeNode *insertLocation =
8686 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
8687 &comparisonResult,
8688 &d_tree,
8689 this->comparator(),
8690 lvalue,
8691 hintNode);
8692 if (!comparisonResult) {
8693 return iterator(insertLocation);
8694 }
8695
8696#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8697 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8698 std::piecewise_construct,
8699 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(key_type, key)),
8700 std::forward_as_tuple(
8701 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01)));
8702#else
8703 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8704 BSLS_COMPILERFEATURES_FORWARD(key_type, key),
8705 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01)));
8706#endif
8707
8708 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
8709 insertLocation,
8710 comparisonResult < 0,
8711 node);
8712 return iterator(node);
8713}
8714#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 1
8715
8716#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 2
8717template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
8718template <class Args_01,
8719 class Args_02>
8720inline
8721typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
8722map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(
8723 const_iterator hint,
8724 BloombergLP::bslmf::MovableRef<key_type> key,
8725 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
8726 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02)
8727{
8728 key_type& lvalue = key;
8729
8730 BloombergLP::bslalg::RbTreeNode *hintNode =
8731 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
8732 int comparisonResult;
8733 BloombergLP::bslalg::RbTreeNode *insertLocation =
8734 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
8735 &comparisonResult,
8736 &d_tree,
8737 this->comparator(),
8738 lvalue,
8739 hintNode);
8740 if (!comparisonResult) {
8741 return iterator(insertLocation);
8742 }
8743
8744#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8745 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8746 std::piecewise_construct,
8747 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(key_type, key)),
8748 std::forward_as_tuple(
8749 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8750 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02)));
8751#else
8752 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8753 BSLS_COMPILERFEATURES_FORWARD(key_type, key),
8754 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8755 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02)));
8756#endif
8757
8758 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
8759 insertLocation,
8760 comparisonResult < 0,
8761 node);
8762 return iterator(node);
8763}
8764#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 2
8765
8766#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 3
8767template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
8768template <class Args_01,
8769 class Args_02,
8770 class Args_03>
8771inline
8772typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
8773map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(
8774 const_iterator hint,
8775 BloombergLP::bslmf::MovableRef<key_type> key,
8776 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
8777 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
8778 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03)
8779{
8780 key_type& lvalue = key;
8781
8782 BloombergLP::bslalg::RbTreeNode *hintNode =
8783 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
8784 int comparisonResult;
8785 BloombergLP::bslalg::RbTreeNode *insertLocation =
8786 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
8787 &comparisonResult,
8788 &d_tree,
8789 this->comparator(),
8790 lvalue,
8791 hintNode);
8792 if (!comparisonResult) {
8793 return iterator(insertLocation);
8794 }
8795
8796#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8797 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8798 std::piecewise_construct,
8799 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(key_type, key)),
8800 std::forward_as_tuple(
8801 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8802 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
8803 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03)));
8804#else
8805 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8806 BSLS_COMPILERFEATURES_FORWARD(key_type, key),
8807 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8808 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
8809 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03)));
8810#endif
8811
8812 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
8813 insertLocation,
8814 comparisonResult < 0,
8815 node);
8816 return iterator(node);
8817}
8818#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 3
8819
8820#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 4
8821template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
8822template <class Args_01,
8823 class Args_02,
8824 class Args_03,
8825 class Args_04>
8826inline
8827typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
8828map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(
8829 const_iterator hint,
8830 BloombergLP::bslmf::MovableRef<key_type> key,
8831 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
8832 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
8833 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
8834 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04)
8835{
8836 key_type& lvalue = key;
8837
8838 BloombergLP::bslalg::RbTreeNode *hintNode =
8839 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
8840 int comparisonResult;
8841 BloombergLP::bslalg::RbTreeNode *insertLocation =
8842 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
8843 &comparisonResult,
8844 &d_tree,
8845 this->comparator(),
8846 lvalue,
8847 hintNode);
8848 if (!comparisonResult) {
8849 return iterator(insertLocation);
8850 }
8851
8852#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8853 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8854 std::piecewise_construct,
8855 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(key_type, key)),
8856 std::forward_as_tuple(
8857 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8858 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
8859 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
8860 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04)));
8861#else
8862 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8863 BSLS_COMPILERFEATURES_FORWARD(key_type, key),
8864 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8865 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
8866 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
8867 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04)));
8868#endif
8869
8870 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
8871 insertLocation,
8872 comparisonResult < 0,
8873 node);
8874 return iterator(node);
8875}
8876#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 4
8877
8878#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 5
8879template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
8880template <class Args_01,
8881 class Args_02,
8882 class Args_03,
8883 class Args_04,
8884 class Args_05>
8885inline
8886typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
8887map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(
8888 const_iterator hint,
8889 BloombergLP::bslmf::MovableRef<key_type> key,
8890 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
8891 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
8892 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
8893 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
8894 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05)
8895{
8896 key_type& lvalue = key;
8897
8898 BloombergLP::bslalg::RbTreeNode *hintNode =
8899 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
8900 int comparisonResult;
8901 BloombergLP::bslalg::RbTreeNode *insertLocation =
8902 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
8903 &comparisonResult,
8904 &d_tree,
8905 this->comparator(),
8906 lvalue,
8907 hintNode);
8908 if (!comparisonResult) {
8909 return iterator(insertLocation);
8910 }
8911
8912#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8913 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8914 std::piecewise_construct,
8915 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(key_type, key)),
8916 std::forward_as_tuple(
8917 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8918 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
8919 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
8920 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
8921 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05)));
8922#else
8923 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8924 BSLS_COMPILERFEATURES_FORWARD(key_type, key),
8925 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8926 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
8927 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
8928 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
8929 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05)));
8930#endif
8931
8932 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
8933 insertLocation,
8934 comparisonResult < 0,
8935 node);
8936 return iterator(node);
8937}
8938#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 5
8939
8940#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 6
8941template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
8942template <class Args_01,
8943 class Args_02,
8944 class Args_03,
8945 class Args_04,
8946 class Args_05,
8947 class Args_06>
8948inline
8949typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
8950map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(
8951 const_iterator hint,
8952 BloombergLP::bslmf::MovableRef<key_type> key,
8953 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
8954 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
8955 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
8956 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
8957 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
8958 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06)
8959{
8960 key_type& lvalue = key;
8961
8962 BloombergLP::bslalg::RbTreeNode *hintNode =
8963 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
8964 int comparisonResult;
8965 BloombergLP::bslalg::RbTreeNode *insertLocation =
8966 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
8967 &comparisonResult,
8968 &d_tree,
8969 this->comparator(),
8970 lvalue,
8971 hintNode);
8972 if (!comparisonResult) {
8973 return iterator(insertLocation);
8974 }
8975
8976#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
8977 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8978 std::piecewise_construct,
8979 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(key_type, key)),
8980 std::forward_as_tuple(
8981 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8982 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
8983 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
8984 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
8985 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
8986 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06)));
8987#else
8988 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
8989 BSLS_COMPILERFEATURES_FORWARD(key_type, key),
8990 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
8991 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
8992 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
8993 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
8994 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
8995 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06)));
8996#endif
8997
8998 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
8999 insertLocation,
9000 comparisonResult < 0,
9001 node);
9002 return iterator(node);
9003}
9004#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 6
9005
9006#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 7
9007template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9008template <class Args_01,
9009 class Args_02,
9010 class Args_03,
9011 class Args_04,
9012 class Args_05,
9013 class Args_06,
9014 class Args_07>
9015inline
9016typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
9017map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(
9018 const_iterator hint,
9019 BloombergLP::bslmf::MovableRef<key_type> key,
9020 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
9021 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
9022 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
9023 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
9024 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
9025 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
9026 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07)
9027{
9028 key_type& lvalue = key;
9029
9030 BloombergLP::bslalg::RbTreeNode *hintNode =
9031 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
9032 int comparisonResult;
9033 BloombergLP::bslalg::RbTreeNode *insertLocation =
9034 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
9035 &comparisonResult,
9036 &d_tree,
9037 this->comparator(),
9038 lvalue,
9039 hintNode);
9040 if (!comparisonResult) {
9041 return iterator(insertLocation);
9042 }
9043
9044#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
9045 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
9046 std::piecewise_construct,
9047 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(key_type, key)),
9048 std::forward_as_tuple(
9049 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
9050 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
9051 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
9052 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
9053 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
9054 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
9055 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07)));
9056#else
9057 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
9058 BSLS_COMPILERFEATURES_FORWARD(key_type, key),
9059 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
9060 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
9061 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
9062 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
9063 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
9064 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
9065 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07)));
9066#endif
9067
9068 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
9069 insertLocation,
9070 comparisonResult < 0,
9071 node);
9072 return iterator(node);
9073}
9074#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 7
9075
9076#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 8
9077template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9078template <class Args_01,
9079 class Args_02,
9080 class Args_03,
9081 class Args_04,
9082 class Args_05,
9083 class Args_06,
9084 class Args_07,
9085 class Args_08>
9086inline
9087typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
9088map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(
9089 const_iterator hint,
9090 BloombergLP::bslmf::MovableRef<key_type> key,
9091 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
9092 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
9093 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
9094 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
9095 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
9096 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
9097 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
9098 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08)
9099{
9100 key_type& lvalue = key;
9101
9102 BloombergLP::bslalg::RbTreeNode *hintNode =
9103 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
9104 int comparisonResult;
9105 BloombergLP::bslalg::RbTreeNode *insertLocation =
9106 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
9107 &comparisonResult,
9108 &d_tree,
9109 this->comparator(),
9110 lvalue,
9111 hintNode);
9112 if (!comparisonResult) {
9113 return iterator(insertLocation);
9114 }
9115
9116#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
9117 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
9118 std::piecewise_construct,
9119 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(key_type, key)),
9120 std::forward_as_tuple(
9121 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
9122 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
9123 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
9124 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
9125 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
9126 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
9127 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
9128 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08)));
9129#else
9130 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
9131 BSLS_COMPILERFEATURES_FORWARD(key_type, key),
9132 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
9133 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
9134 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
9135 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
9136 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
9137 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
9138 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
9139 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08)));
9140#endif
9141
9142 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
9143 insertLocation,
9144 comparisonResult < 0,
9145 node);
9146 return iterator(node);
9147}
9148#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 8
9149
9150#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 9
9151template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9152template <class Args_01,
9153 class Args_02,
9154 class Args_03,
9155 class Args_04,
9156 class Args_05,
9157 class Args_06,
9158 class Args_07,
9159 class Args_08,
9160 class Args_09>
9161inline
9162typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
9163map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(
9164 const_iterator hint,
9165 BloombergLP::bslmf::MovableRef<key_type> key,
9166 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
9167 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
9168 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
9169 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
9170 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
9171 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
9172 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
9173 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
9174 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09)
9175{
9176 key_type& lvalue = key;
9177
9178 BloombergLP::bslalg::RbTreeNode *hintNode =
9179 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
9180 int comparisonResult;
9181 BloombergLP::bslalg::RbTreeNode *insertLocation =
9182 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
9183 &comparisonResult,
9184 &d_tree,
9185 this->comparator(),
9186 lvalue,
9187 hintNode);
9188 if (!comparisonResult) {
9189 return iterator(insertLocation);
9190 }
9191
9192#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
9193 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
9194 std::piecewise_construct,
9195 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(key_type, key)),
9196 std::forward_as_tuple(
9197 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
9198 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
9199 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
9200 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
9201 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
9202 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
9203 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
9204 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08),
9205 BSLS_COMPILERFEATURES_FORWARD(Args_09, args_09)));
9206#else
9207 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
9208 BSLS_COMPILERFEATURES_FORWARD(key_type, key),
9209 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
9210 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
9211 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
9212 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
9213 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
9214 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
9215 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
9216 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08),
9217 BSLS_COMPILERFEATURES_FORWARD(Args_09, args_09)));
9218#endif
9219
9220 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
9221 insertLocation,
9222 comparisonResult < 0,
9223 node);
9224 return iterator(node);
9225}
9226#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 9
9227
9228#if BSLSTL_MAP_VARIADIC_LIMIT_G >= 10
9229template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9230template <class Args_01,
9231 class Args_02,
9232 class Args_03,
9233 class Args_04,
9234 class Args_05,
9235 class Args_06,
9236 class Args_07,
9237 class Args_08,
9238 class Args_09,
9239 class Args_10>
9240inline
9241typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
9242map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(
9243 const_iterator hint,
9244 BloombergLP::bslmf::MovableRef<key_type> key,
9245 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
9246 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
9247 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
9248 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
9249 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
9250 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
9251 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
9252 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
9253 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09,
9254 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) args_10)
9255{
9256 key_type& lvalue = key;
9257
9258 BloombergLP::bslalg::RbTreeNode *hintNode =
9259 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
9260 int comparisonResult;
9261 BloombergLP::bslalg::RbTreeNode *insertLocation =
9262 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
9263 &comparisonResult,
9264 &d_tree,
9265 this->comparator(),
9266 lvalue,
9267 hintNode);
9268 if (!comparisonResult) {
9269 return iterator(insertLocation);
9270 }
9271
9272#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
9273 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
9274 std::piecewise_construct,
9275 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(key_type, key)),
9276 std::forward_as_tuple(
9277 BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
9278 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
9279 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
9280 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
9281 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
9282 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
9283 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
9284 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08),
9285 BSLS_COMPILERFEATURES_FORWARD(Args_09, args_09),
9286 BSLS_COMPILERFEATURES_FORWARD(Args_10, args_10)));
9287#else
9288 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
9289 BSLS_COMPILERFEATURES_FORWARD(key_type, key),
9290 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args_01, args_01),
9291 BSLS_COMPILERFEATURES_FORWARD(Args_02, args_02),
9292 BSLS_COMPILERFEATURES_FORWARD(Args_03, args_03),
9293 BSLS_COMPILERFEATURES_FORWARD(Args_04, args_04),
9294 BSLS_COMPILERFEATURES_FORWARD(Args_05, args_05),
9295 BSLS_COMPILERFEATURES_FORWARD(Args_06, args_06),
9296 BSLS_COMPILERFEATURES_FORWARD(Args_07, args_07),
9297 BSLS_COMPILERFEATURES_FORWARD(Args_08, args_08),
9298 BSLS_COMPILERFEATURES_FORWARD(Args_09, args_09),
9299 BSLS_COMPILERFEATURES_FORWARD(Args_10, args_10)));
9300#endif
9301
9302 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
9303 insertLocation,
9304 comparisonResult < 0,
9305 node);
9306 return iterator(node);
9307}
9308#endif // BSLSTL_MAP_VARIADIC_LIMIT_G >= 10
9309
9310#else
9311// The generated code below is a workaround for the absence of perfect
9312// forwarding in some compilers.
9313template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9314template <class... Args>
9315inline
9316pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
9317map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(const key_type& key,
9319{
9320 int comparisonResult;
9321 BloombergLP::bslalg::RbTreeNode *insertLocation =
9322 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
9323 &comparisonResult,
9324 &d_tree,
9325 this->comparator(),
9326 key);
9327 if (!comparisonResult) {
9328 return pair<iterator, bool>(iterator(insertLocation), false);
9329 }
9330
9331#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
9332 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
9333 std::piecewise_construct,
9334 std::forward_as_tuple(key),
9335 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(Args, args)...));
9336#else
9337 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
9338 key,
9339 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args, args)...));
9340#endif
9341
9342 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
9343 insertLocation,
9344 comparisonResult < 0,
9345 node);
9346 return pair<iterator, bool>(iterator(node), true);
9347}
9348
9349template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9350template <class... Args>
9351inline
9352typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
9353map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(const_iterator hint,
9354 const key_type& key,
9356{
9357 BloombergLP::bslalg::RbTreeNode *hintNode =
9358 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
9359 int comparisonResult;
9360 BloombergLP::bslalg::RbTreeNode *insertLocation =
9361 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
9362 &comparisonResult,
9363 &d_tree,
9364 this->comparator(),
9365 key,
9366 hintNode);
9367 if (!comparisonResult) {
9368 return iterator(insertLocation);
9369 }
9370
9371#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
9372 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
9373 std::piecewise_construct,
9374 std::forward_as_tuple(key),
9375 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(Args, args)...));
9376#else
9377 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
9378 key,
9379 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args, args)...));
9380#endif
9381
9382 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
9383 insertLocation,
9384 comparisonResult < 0,
9385 node);
9386 return iterator(node);
9387}
9388
9389template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9390template <class... Args>
9391inline
9392pair<typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator, bool>
9393map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(
9394 BloombergLP::bslmf::MovableRef<key_type> key,
9396{
9397 key_type& lvalue = key;
9398
9399 int comparisonResult;
9400 BloombergLP::bslalg::RbTreeNode *insertLocation =
9401 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
9402 &comparisonResult,
9403 &d_tree,
9404 this->comparator(),
9405 lvalue);
9406 if (!comparisonResult) {
9407 return pair<iterator, bool>(iterator(insertLocation), false);
9408 }
9409
9410#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
9411 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
9412 std::piecewise_construct,
9413 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(key_type, key)),
9414 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(Args, args)...));
9415#else
9416 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
9417 BSLS_COMPILERFEATURES_FORWARD(key_type, key),
9418 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args, args)...));
9419#endif
9420
9421 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
9422 insertLocation,
9423 comparisonResult < 0,
9424 node);
9425
9426 return pair<iterator, bool>(iterator(node), true);
9427}
9428
9429template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9430template <class... Args>
9431inline
9432typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::iterator
9433map<KEY, VALUE, COMPARATOR, ALLOCATOR>::try_emplace(
9434 const_iterator hint,
9435 BloombergLP::bslmf::MovableRef<key_type> key,
9437{
9438 key_type& lvalue = key;
9439
9440 BloombergLP::bslalg::RbTreeNode *hintNode =
9441 const_cast<BloombergLP::bslalg::RbTreeNode *>(hint.node());
9442 int comparisonResult;
9443 BloombergLP::bslalg::RbTreeNode *insertLocation =
9444 BloombergLP::bslalg::RbTreeUtil::findUniqueInsertLocation(
9445 &comparisonResult,
9446 &d_tree,
9447 this->comparator(),
9448 lvalue,
9449 hintNode);
9450 if (!comparisonResult) {
9451 return iterator(insertLocation);
9452 }
9453
9454#if defined(BSLS_LIBRARYFEATURES_HAS_CPP11_PAIR_PIECEWISE_CONSTRUCTOR)
9455 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
9456 std::piecewise_construct,
9457 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(key_type, key)),
9458 std::forward_as_tuple(BSLS_COMPILERFEATURES_FORWARD(Args, args)...));
9459#else
9460 BloombergLP::bslalg::RbTreeNode *node = nodeFactory().emplaceIntoNewNode(
9461 BSLS_COMPILERFEATURES_FORWARD(key_type, key),
9462 mapped_type(BSLS_COMPILERFEATURES_FORWARD(Args, args)...));
9463#endif
9464
9465 BloombergLP::bslalg::RbTreeUtil::insertAt(&d_tree,
9466 insertLocation,
9467 comparisonResult < 0,
9468 node);
9469 return iterator(node);
9470}
9471// }}} END GENERATED CODE
9472#endif
9473
9474template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9475inline
9476void map<KEY, VALUE, COMPARATOR, ALLOCATOR>::clear() BSLS_KEYWORD_NOEXCEPT
9477{
9478 BSLS_ASSERT_SAFE(d_tree.firstNode());
9479
9480 if (d_tree.rootNode()) {
9481 BSLS_ASSERT_SAFE( 0 < d_tree.numNodes());
9482 BSLS_ASSERT_SAFE(d_tree.firstNode() != d_tree.sentinel());
9483
9484 BloombergLP::bslalg::RbTreeUtil::deleteTree(&d_tree, &nodeFactory());
9485 }
9486#if defined(BSLS_ASSERT_SAFE_IS_USED)
9487 else {
9488 BSLS_ASSERT_SAFE( 0 == d_tree.numNodes());
9489 BSLS_ASSERT_SAFE(d_tree.firstNode() == d_tree.sentinel());
9490 }
9491#endif
9492}
9493
9494// ACCESSORS
9495template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9496inline
9497typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::allocator_type
9498map<KEY, VALUE, COMPARATOR, ALLOCATOR>::get_allocator() const
9500{
9501 return nodeFactory().allocator();
9502}
9503
9504template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9505inline
9506typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::const_iterator
9507map<KEY, VALUE, COMPARATOR, ALLOCATOR>::begin() const BSLS_KEYWORD_NOEXCEPT
9508{
9509 return cbegin();
9510}
9511
9512template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9513inline
9514typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::const_iterator
9515map<KEY, VALUE, COMPARATOR, ALLOCATOR>::end() const BSLS_KEYWORD_NOEXCEPT
9516{
9517 return cend();
9518}
9519
9520template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9521inline
9522typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::const_reverse_iterator
9523map<KEY, VALUE, COMPARATOR, ALLOCATOR>::rbegin() const BSLS_KEYWORD_NOEXCEPT
9524{
9525 return crbegin();
9526}
9527
9528template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9529inline
9530typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::const_reverse_iterator
9531map<KEY, VALUE, COMPARATOR, ALLOCATOR>::rend() const BSLS_KEYWORD_NOEXCEPT
9532{
9533 return crend();
9534}
9535
9536template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9537inline
9538typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::const_iterator
9539map<KEY, VALUE, COMPARATOR, ALLOCATOR>::cbegin() const BSLS_KEYWORD_NOEXCEPT
9540{
9541 return const_iterator(d_tree.firstNode());
9542}
9543
9544template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9545inline
9546typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::const_iterator
9547map<KEY, VALUE, COMPARATOR, ALLOCATOR>::cend() const BSLS_KEYWORD_NOEXCEPT
9548{
9549 return const_iterator(d_tree.sentinel());
9550}
9551
9552template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9553inline
9554typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::const_reverse_iterator
9555map<KEY, VALUE, COMPARATOR, ALLOCATOR>::crbegin() const BSLS_KEYWORD_NOEXCEPT
9556{
9557 return const_reverse_iterator(end());
9558}
9559
9560template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9561inline
9562typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::const_reverse_iterator
9563map<KEY, VALUE, COMPARATOR, ALLOCATOR>::crend() const BSLS_KEYWORD_NOEXCEPT
9564{
9565 return const_reverse_iterator(begin());
9566}
9567
9568template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9569inline
9570bool map<KEY, VALUE, COMPARATOR, ALLOCATOR>::contains(
9571 const key_type& key) const
9572{
9573 return find(key) != end();
9574}
9575
9576// capacity:
9577template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9578inline
9579bool map<KEY, VALUE, COMPARATOR, ALLOCATOR>::empty() const
9581{
9582 return 0 == d_tree.numNodes();
9583}
9584
9585template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9586inline
9587typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::size_type
9588map<KEY, VALUE, COMPARATOR, ALLOCATOR>::size() const BSLS_KEYWORD_NOEXCEPT
9589{
9590 return d_tree.numNodes();
9591}
9592
9593template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9594inline
9595typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::size_type
9596map<KEY, VALUE, COMPARATOR, ALLOCATOR>::max_size() const BSLS_KEYWORD_NOEXCEPT
9597{
9598 return AllocatorTraits::max_size(get_allocator());
9599}
9600
9601template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9602typename add_lvalue_reference<const VALUE>::type
9603map<KEY, VALUE, COMPARATOR, ALLOCATOR>::at(
9604 const key_type& key) const
9605{
9606 const BloombergLP::bslalg::RbTreeNode *node =
9607 BloombergLP::bslalg::RbTreeUtil::find(d_tree,
9608 this->comparator(),
9609 key);
9610 if (d_tree.sentinel() == node) {
9611 BloombergLP::bslstl::StdExceptUtil::throwOutOfRange(
9612 "map<...>::at(key_type): invalid key value");
9613 }
9614 return toNode(node)->value().second;
9615}
9616
9617template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9618inline
9619typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::key_compare
9620map<KEY, VALUE, COMPARATOR, ALLOCATOR>::key_comp() const
9621{
9622 return comparator().keyComparator();
9623}
9624
9625template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9626inline
9627typename map<KEY, VALUE, COMPARATOR, ALLOCATOR>::value_compare
9628map<KEY, VALUE, COMPARATOR, ALLOCATOR>::value_comp() const
9629{
9630 return value_compare(key_comp());
9631}
9632
9633} // close namespace bsl
9634
9635// FREE OPERATORS
9636template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9637inline
9640{
9641 return BloombergLP::bslalg::RangeCompare::equal(lhs.begin(),
9642 lhs.end(),
9643 lhs.size(),
9644 rhs.begin(),
9645 rhs.end(),
9646 rhs.size());
9647}
9648
9649#ifndef BSLS_COMPILERFEATURES_SUPPORT_THREE_WAY_COMPARISON
9650template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9651inline
9654{
9655 return !(lhs == rhs);
9656}
9657#endif
9658
9659#ifdef BSLALG_SYNTHTHREEWAYUTIL_AVAILABLE
9660
9661template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9662inline
9663BloombergLP::bslalg::SynthThreeWayUtil::Result<bsl::pair<const KEY, VALUE>>
9664bsl::operator<=>(const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& lhs,
9665 const map<KEY, VALUE, COMPARATOR, ALLOCATOR>& rhs)
9666{
9667 return bsl::lexicographical_compare_three_way(
9668 lhs.begin(),
9669 lhs.end(),
9670 rhs.begin(),
9671 rhs.end(),
9672 BloombergLP::bslalg::SynthThreeWayUtil::compare);
9673}
9674
9675#else
9676
9677template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9678inline
9681{
9682 return 0 > BloombergLP::bslalg::RangeCompare::lexicographical(lhs.begin(),
9683 lhs.end(),
9684 lhs.size(),
9685 rhs.begin(),
9686 rhs.end(),
9687 rhs.size());
9688}
9689
9690template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9691inline
9694{
9695 return rhs < lhs;
9696}
9697
9698template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9699inline
9702{
9703 return !(rhs < lhs);
9704}
9705
9706template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9707inline
9710{
9711 return !(lhs < rhs);
9712}
9713
9714#endif // BSLALG_SYNTHTHREEWAYUTIL_AVAILABLE
9715
9716// FREE FUNCTIONS
9717template <class KEY,
9718 class VALUE,
9719 class COMPARATOR,
9720 class ALLOCATOR,
9721 class PREDICATE>
9722inline
9724bsl::erase_if(map<KEY, VALUE, COMPARATOR, ALLOCATOR>& m, PREDICATE predicate)
9725{
9726 return BloombergLP::bslstl::AlgorithmUtil::containerEraseIf(m, predicate);
9727}
9728
9729template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9730inline
9734{
9735 a.swap(b);
9736}
9737
9738// ============================================================================
9739// TYPE TRAITS
9740// ============================================================================
9741
9742// Type traits for STL *ordered* containers:
9743//: o An ordered container defines STL iterators.
9744//: o An ordered container uses 'bslma' allocators if the (template parameter)
9745//: type 'ALLOCATOR' is convertible from 'bslma::Allocator *'.
9746
9747
9748
9749namespace bslalg {
9750
9751template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9752struct HasStlIterators<bsl::map<KEY, VALUE, COMPARATOR, ALLOCATOR> >
9754{
9755};
9756
9757} // close namespace bslalg
9758
9759namespace bslma {
9760
9761template <class KEY, class VALUE, class COMPARATOR, class ALLOCATOR>
9762struct UsesBslmaAllocator<bsl::map<KEY, VALUE, COMPARATOR, ALLOCATOR> >
9763 : bsl::is_convertible<Allocator *, ALLOCATOR>
9764{
9765};
9766
9767} // close namespace bslma
9768
9769
9770
9771#else // if ! defined(DEFINED_BSLSTL_MAP_H)
9772# error Not valid except when included from bslstl_map.h
9773#endif // ! defined(COMPILING_BSLSTL_MAP_H)
9774
9775#endif // ! defined(INCLUDED_BSLSTL_MAP_CPP03)
9776
9777// ----------------------------------------------------------------------------
9778// Copyright 2019 Bloomberg Finance L.P.
9779//
9780// Licensed under the Apache License, Version 2.0 (the "License");
9781// you may not use this file except in compliance with the License.
9782// You may obtain a copy of the License at
9783//
9784// http://www.apache.org/licenses/LICENSE-2.0
9785//
9786// Unless required by applicable law or agreed to in writing, software
9787// distributed under the License is distributed on an "AS IS" BASIS,
9788// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9789// See the License for the specific language governing permissions and
9790// limitations under the License.
9791// ----------------------------- END-OF-FILE ----------------------------------
9792
9793/** @} */
9794/** @} */
9795/** @} */
Definition bslma_bslallocator.h:588
value_compare(COMPARATOR comparator)
Definition bslstl_map.h:2715
value_type second_argument_type
Definition bslstl_map.h:803
COMPARATOR comp
Definition bslstl_map.h:778
bool operator()(const value_type &x, const value_type &y) const
Definition bslstl_map.h:2724
value_type first_argument_type
Definition bslstl_map.h:798
value_compare & operator=(const value_compare &rhs)=default
friend class map
Definition bslstl_map.h:774
bool result_type
Definition bslstl_map.h:793
Definition bslstl_map.h:653
value_type & reference
Definition bslstl_map.h:747
iterator erase(const_iterator position)
Definition bslstl_map.h:3687
void insert_range(BSLS_COMPILERFEATURES_FORWARD_REF(RANGE) range)
Definition bslstl_map.h:1449
allocator_type get_allocator() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_map.h:3949
const_reverse_iterator crend() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_map.h:4014
map &operator=(BloombergLP::bslmf::MovableRef< map > rhs) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits add_lvalue_reference< VALUE >::type operator[](const key_type &key)
Definition bslstl_map.h:3221
bool contains(const key_type &key) const
Definition bslstl_map.h:4021
BloombergLP::bslstl::TreeIterator< const value_type, Node, difference_type > const_iterator
Definition bslstl_map.h:758
reverse_iterator rend() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_map.h:3324
pair< iterator, iterator > equal_range(const key_type &key)
Definition bslstl_map.h:1999
iterator upper_bound(const key_type &key)
Definition bslstl_map.h:1958
iterator end() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_map.h:3308
map()
Definition bslstl_map.h:3021
~map()
Destroy this object.
Definition bslstl_map.h:3152
const_reverse_iterator crbegin() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_map.h:4006
reverse_iterator rbegin() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_map.h:3316
iterator lower_bound(const key_type &key)
Definition bslstl_map.h:1919
size_type count(const key_type &key) const
Definition bslstl_map.h:2216
const value_type & const_reference
Definition bslstl_map.h:748
KEY key_type
Definition bslstl_map.h:742
AllocatorTraits::const_pointer const_pointer
Definition bslstl_map.h:753
add_lvalue_reference< VALUE >::type at(const key_type &key)
Definition bslstl_map.h:3286
pair< iterator, bool > emplace(Args &&... args)
bsl::reverse_iterator< iterator > reverse_iterator
Definition bslstl_map.h:759
iterator find(const key_type &key)
Definition bslstl_map.h:1885
void swap(map &other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits pair< iterator, bool > try_emplace(const KEY &key, Args &&... args)
Definition bslstl_map.h:1758
ALLOCATOR allocator_type
Definition bslstl_map.h:746
map & operator=(const map &rhs)
Definition bslstl_map.h:3161
bool empty() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_map.h:4030
pair< iterator, bool > insert_or_assign(const KEY &key, BDE_OTHER_TYPE &&obj)
size_type size() const BSLS_KEYWORD_NOEXCEPT
Return the number of elements in this map.
Definition bslstl_map.h:4039
pair< iterator, bool > insert(const value_type &value)
Definition bslstl_map.h:3332
iterator begin() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_map.h:3300
VALUE mapped_type
Definition bslstl_map.h:743
void clear() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_map.h:3927
value_compare value_comp() const
Definition bslstl_map.h:4079
const_iterator cbegin() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_map.h:3990
size_type max_size() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_map.h:4047
bsl::reverse_iterator< const_iterator > const_reverse_iterator
Definition bslstl_map.h:760
AllocatorTraits::size_type size_type
Definition bslstl_map.h:750
iterator emplace_hint(const_iterator hint, Args &&... args)
Definition bslstl_map.h:3655
const_iterator cend() const BSLS_KEYWORD_NOEXCEPT
Definition bslstl_map.h:3998
BloombergLP::bslstl::TreeIterator< value_type, Node, difference_type > iterator
Definition bslstl_map.h:756
pair< const KEY, VALUE > value_type
Definition bslstl_map.h:744
AllocatorTraits::pointer pointer
Definition bslstl_map.h:752
AllocatorTraits::difference_type difference_type
Definition bslstl_map.h:751
key_compare key_comp() const
Definition bslstl_map.h:4071
COMPARATOR key_compare
Definition bslstl_map.h:745
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1917
#define BSLS_COMPILERFEATURES_FORWARD_REF(T)
Definition bsls_compilerfeatures.h:2343
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2349
#define BSLS_KEYWORD_CONSTEXPR_CPP17
Definition bsls_keyword.h:639
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:674
#define BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(...)
Definition bsls_keyword.h:676
#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
#define BSLSTL_MAP_REQUIRES_CONTAINER_COMPATIBLE_RANGE(R, T)
Definition bslstl_map.h:613
void swap(OptionValue &a, OptionValue &b)
Definition bdlat_valuetypefunctions.h:939
void swap(array< VALUE_TYPE, SIZE > &lhs, array< VALUE_TYPE, SIZE > &rhs)
T::const_iterator cend(const T &container)
Definition bslstl_iterator.h:1709
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:1695
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)
ALLOCATOR const STRING_VIEW_LIKE_TYPE & rhs
Definition bslstl_string.h:3918
deque< VALUE_TYPE, ALLOCATOR >::size_type erase(deque< VALUE_TYPE, ALLOCATOR > &deq, const BDE_OTHER_TYPE &value)
Definition bslstl_deque.h:4424
T::iterator begin(T &container)
Definition bslstl_iterator.h:1593
const from_range_t from_range
bool operator==(const memory_resource &a, const memory_resource &b)
T::const_iterator cbegin(const T &container)
Definition bslstl_iterator.h:1651
ALLOCATOR & lhs
Definition bslstl_string.h:3917
T::iterator end(T &container)
Definition bslstl_iterator.h:1621
deque< VALUE_TYPE, ALLOCATOR >::size_type erase_if(deque< VALUE_TYPE, ALLOCATOR > &deq, PREDICATE predicate)
Definition bslstl_deque.h:4433
bool operator!=(const memory_resource &a, const memory_resource &b)
T::const_reverse_iterator crend(const T &container)
Definition bslstl_iterator.h:1752
Definition bdlc_flathashmap.h:2218
Definition baljsn_encoder_testtypes.h:76
Definition bdlbb_blob.h:579
t_TYPE & type
This typedef defines the return type of this meta function.
Definition bslmf_addlvaluereference.h:131
Definition bslma_allocatortraits.h:1089
BloombergLP::bslma::AllocatorTraits_ConstPointerType< ALLOCATOR >::type const_pointer
Definition bslma_allocatortraits.h:1183
BloombergLP::bslma::AllocatorTraits_SizeType< ALLOCATOR >::type size_type
Definition bslma_allocatortraits.h:1196
BloombergLP::bslma::AllocatorTraits_PointerType< ALLOCATOR >::type pointer
Definition bslma_allocatortraits.h:1180
BloombergLP::bslma::AllocatorTraits_DifferenceType< ALLOCATOR >::type difference_type
Definition bslma_allocatortraits.h:1193
Definition bslmf_enableif.h:530
Definition bslstl_ranges.h:301
Definition bslmf_isconvertible.h:875