BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslstl_priorityqueue_cpp03.h
Go to the documentation of this file.
1/// @file bslstl_priorityqueue_cpp03.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bslstl_priorityqueue_cpp03.h -*-C++-*-
8
9// Automatically generated file. **DO NOT EDIT**
10
11#ifndef INCLUDED_BSLSTL_PRIORITYQUEUE_CPP03
12#define INCLUDED_BSLSTL_PRIORITYQUEUE_CPP03
13
14/// @defgroup bslstl_priorityqueue_cpp03 bslstl_priorityqueue_cpp03
15/// @brief Provide C++03 implementation for bslstl_priorityqueue.h
16/// @addtogroup bsl
17/// @{
18/// @addtogroup bslstl
19/// @{
20/// @addtogroup bslstl_priorityqueue_cpp03
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bslstl_priorityqueue_cpp03-purpose"> Purpose</a>
25/// * <a href="#bslstl_priorityqueue_cpp03-classes"> Classes </a>
26/// * <a href="#bslstl_priorityqueue_cpp03-description"> Description </a>
27///
28/// # Purpose {#bslstl_priorityqueue_cpp03-purpose}
29/// Provide C++03 implementation for bslstl_priorityqueue.h
30///
31/// # Classes {#bslstl_priorityqueue_cpp03-classes}
32/// See bslstl_priorityqueue.h for list of classes
33///
34/// @see bslstl_priorityqueue
35///
36/// # Description {#bslstl_priorityqueue_cpp03-description}
37/// This component is the C++03 translation of a C++11 component,
38/// generated by the 'sim_cpp11_features.pl' program. If the original header
39/// contains any specially delimited regions of C++11 code, then this generated
40/// file contains the C++03 equivalent, i.e., with variadic templates expanded
41/// and rvalue-references replaced by 'bslmf::MovableRef' objects. The header
42/// code in this file is designed to be '#include'd into the original header
43/// when compiling with a C++03 compiler. If there are no specially delimited
44/// regions of C++11 code, then this header contains no code and is not
45/// '#include'd in the original header.
46///
47/// Generated on Sun Sep 1 05:39:10 2024
48/// Command line: sim_cpp11_features.pl bslstl_priorityqueue.h
49/// @}
50/** @} */
51/** @} */
52
53/** @addtogroup bsl
54 * @{
55 */
56/** @addtogroup bslstl
57 * @{
58 */
59/** @addtogroup bslstl_priorityqueue_cpp03
60 * @{
61 */
62
63#ifdef COMPILING_BSLSTL_PRIORITYQUEUE_H
64
65namespace bsl {
66
67 // ====================
68 // class priority_queue
69 // ====================
70
71/// This class is a value-semantic class template, adapting a container of
72/// the (template parameter) type `CONTAINER`, that holds elements of the
73/// (template parameter) type `VALUE`, to provide a highest-priority-first
74/// priority queue data structure, where the priorities of elements are
75/// compared by a comparator of the template parameter type, `COMPARATOR`.
76/// The container object held by a @ref priority_queue class object is
77/// referenced as `c` in the following documentation.
78///
79/// See @ref bslstl_priorityqueue_cpp03
80template <class VALUE,
81 class CONTAINER = vector<VALUE>,
82 class COMPARATOR = std::less<typename CONTAINER::value_type> >
83class priority_queue {
84
85#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
86 // STATIC CHECK: Type mismatch is UB per C++17
88#endif
89
90 private:
91 // PRIVATE TYPES
92
93 /// This `typedef` is a convenient alias for the utility associated with
94 /// movable references.
95 typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;
96
97 public:
98 // PUBLIC TYPES
99 typedef CONTAINER container_type;
100 typedef COMPARATOR value_compare;
101 typedef typename CONTAINER::value_type value_type;
102 typedef typename CONTAINER::reference reference;
103 typedef typename CONTAINER::const_reference const_reference;
104 typedef typename CONTAINER::size_type size_type;
105
106 protected:
107 // PROTECTED DATA
108 CONTAINER c; // container for elements in the 'priority_queue'. This
109 // data member exactly matches its definition in the
110 // C++11 standard [23.6.4].
111
112 COMPARATOR comp; // comparator that defines the priority order of elements
113 // in the @ref priority_queue . This data member exactly
114 // matches its definition in the C++11 standard [23.6.4].
115
116 public:
117 // TRAITS
120 BloombergLP::bslma::UsesBslmaAllocator,
121 BloombergLP::bslma::UsesBslmaAllocator<container_type>::value);
122
123 // CREATORS
124
125 /// Create an empty priority queue, adapting a default-constructed
126 /// container of the (template parameter) type `CONTAINER`. Use a
127 /// default-constructed comparator of the (template parameter) type
128 /// `COMPARATOR` to order elements in the priority queue.
130
131 /// Create an empty priority queue, adapting a default-constructed
132 /// container of the (template parameter) type `CONTAINER`, and having
133 /// the specified `comparator` of the (template parameter) type
134 /// `COMPARATOR` to order elements in the priority queue.
135 explicit priority_queue(const COMPARATOR& comparator);
136
137 /// Create a priority queue, adapting the specified `container` of the
138 /// (template parameter) type `CONTAINER`, and having the specified
139 /// `comparator` of the (template parameter) type `COMPARATOR` to order
140 /// elements in the priority queue.
141 priority_queue(const COMPARATOR& comparator, const CONTAINER& container);
142
143 /// Create a priority queue, adapting the specified `container` of the
144 /// (template parameter) type `CONTAINER`, and having the specified
145 /// `comparator` of the (template parameter) type `COMPARATOR` to order
146 /// elements in the priority queue.
147 explicit priority_queue(
148 const COMPARATOR& comparator,
149 BloombergLP::bslmf::MovableRef<CONTAINER> container);
150
151
152 /// Create a priority queue, adapting a default-constructed container of
153 /// the (template parameter) type `CONTAINER`, and inserting into the
154 /// container a sequence of `value_type` elements that starts at the
155 /// specified `first` and ends immediately before the specified `last`.
156 /// Use a default-constructed comparator of the (template parameter)
157 /// type `COMPARATOR` to order elements in the priority queue.
158 template <class INPUT_ITERATOR>
159 priority_queue(INPUT_ITERATOR first, INPUT_ITERATOR last);
160
161 /// Create a priority queue, adapting the specified `container`, having
162 /// the specified `comparator` to order the priorities of elements,
163 /// including those originally existed in `container`, and those
164 /// inserted into the `container` from a sequence of `value_type`
165 /// elements starting at the specified `first`, and ending immediately
166 /// before the specified `last`.
167 template <class INPUT_ITERATOR>
168 priority_queue(INPUT_ITERATOR first,
169 INPUT_ITERATOR last,
170 const COMPARATOR& comparator,
171 const CONTAINER& container);
172
173 /// Create a priority queue, adapting the specified `container`, having
174 /// the specified `comparator` to order elements in the priority queue,
175 /// including those originally existed in `container`, and those
176 /// inserted into the `container` from a sequence of `value_type`
177 /// elements starting at the specified `first`, and ending immediately
178 /// before the specified `last`.
179 template <class INPUT_ITERATOR>
181 INPUT_ITERATOR first,
182 INPUT_ITERATOR last,
183 const COMPARATOR& comparator,
184 BloombergLP::bslmf::MovableRef<CONTAINER> container);
185
186 /// Create a priority queue having the same value as the specified
187 /// `original` object. Use a copy of the comparator from `original` to
188 /// order elements in the priority queue.
189 priority_queue(const priority_queue& original);
190
191 /// Create a priority queue having the same value as the specified
192 /// `original` object. Use a copy of the comparator from `original` to
193 /// order elements in the priority queue.
194 priority_queue(BloombergLP::bslmf::MovableRef<priority_queue> original);
195
196 /// Create an empty priority queue, adapting a default-constructed
197 /// container of the (template parameter) type `CONTAINER` that uses the
198 /// specified `basicAllocator` to supply memory. Use a
199 /// default-constructed object of the (template parameter) type
200 /// `COMPARATOR` to order elements in the priority queue. Note that
201 /// this constructor is only defined if the underlying container uses
202 /// allocator. Otherwise this constructor is disabled.
203 template <class ALLOCATOR>
204 explicit
205 priority_queue(const ALLOCATOR& basicAllocator,
206 typename enable_if<
208 ALLOCATOR>::type * = 0);
209
210 /// Create an empty priority queue, adapting a default-constructed
211 /// container of the (template parameter) type `CONTAINER` that uses the
212 /// specified `basicAllocator` to supply memory, and the specified
213 /// `comparator` to order elements in the priority queue. Note that
214 /// this constructor is only defined if the underlying container uses
215 /// allocator. Otherwise this constructor is disabled.
216 template <class ALLOCATOR>
217 priority_queue(const COMPARATOR& comparator,
218 const ALLOCATOR& basicAllocator,
219 typename enable_if<
221 ALLOCATOR>::type * = 0);
222
223 /// Create a priority queue, adapting the specified `container` that
224 /// uses the specified `basicAllocator` to supply memory, and the
225 /// specified `comparator` to order elements in the priority queue.
226 /// Note that this constructor is only defined if the underlying
227 /// container uses allocator. Otherwise this constructor is disabled.
228 template <class ALLOCATOR>
229 priority_queue(const COMPARATOR& comparator,
230 const CONTAINER& container,
231 const ALLOCATOR& basicAllocator,
232 typename enable_if<
234 ALLOCATOR>::type * = 0);
235
236 /// Create a priority queue, adapting the specified `container` that
237 /// uses the specified `basicAllocator` to supply memory, and the
238 /// specified `comparator` to order elements in the priority queue.
239 /// Note that this constructor is only defined if the underlying
240 /// container uses allocator. Otherwise this constructor is disabled.
241 template <class ALLOCATOR>
242 priority_queue(const COMPARATOR& comparator,
243 BloombergLP::bslmf::MovableRef<CONTAINER> container,
244 const ALLOCATOR& basicAllocator,
245 typename enable_if<
247 ALLOCATOR>::type * = 0);
248
249 /// Create a priority queue having the same value as the specified
250 /// `original` object and using the specified `basicAllocator` to supply
251 /// memory. Use a copy of the comparator from `original` to order
252 /// elements in the priority queue. Note that this constructor is only
253 /// defined if the underlying container uses allocator. Otherwise this
254 /// constructor is disabled.
255 template <class ALLOCATOR>
256 priority_queue(const priority_queue& original,
257 const ALLOCATOR& basicAllocator,
258 typename enable_if<
260 ALLOCATOR>::type * = 0);
261
262 /// Create a priority queue having the same value as the specified
263 /// `original` object and using the specified `basicAllocator` to supply
264 /// memory. Use a copy of the comparator from `original` to order
265 /// elements in the priority queue. Note that this constructor is only
266 /// defined if the underlying container uses allocator. Otherwise this
267 /// constructor is disabled.
268 template <class ALLOCATOR>
270 BloombergLP::bslmf::MovableRef<priority_queue> original,
271 const ALLOCATOR& basicAllocator,
272 typename enable_if<
274 ALLOCATOR>::type * = 0);
275
276 // MANIPULATORS
277
278 /// Assign to this object the value and comparator of the specified
279 /// `rhs` object and return a reference providing modifiable access to
280 /// this object.
282
283 /// Assign to this object the value and comparator of the specified
284 /// `rhs` object and return a reference providing modifiable access to
285 /// this object. `rhs` is left in a valid but unspecified state.
287 BloombergLP::bslmf::MovableRef<priority_queue> rhs)
289
290 /// Insert the specified `value` into this priority queue. In effect,
291 /// performs `c.push_back(value);`.
292 void push(const value_type& value);
293
294 /// Insert the specified `value` into this priority queue. In effect,
295 /// performs `c.push_back(value);`.
296 void push(BloombergLP::bslmf::MovableRef<value_type> value);
297
298#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
299// {{{ BEGIN GENERATED CODE
300// Command line: sim_cpp11_features.pl bslstl_priorityqueue.h
301#ifndef BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT
302#define BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT 10
303#endif
304#ifndef BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A
305#define BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT
306#endif
307#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 0
308 void emplace();
309#endif // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 0
310
311#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 1
312 template <class Args_01>
313 void emplace(BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01);
314#endif // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 1
315
316#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 2
317 template <class Args_01,
318 class Args_02>
319 void emplace(BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
320 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02);
321#endif // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 2
322
323#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 3
324 template <class Args_01,
325 class Args_02,
326 class Args_03>
327 void emplace(BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
328 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
329 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03);
330#endif // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 3
331
332#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 4
333 template <class Args_01,
334 class Args_02,
335 class Args_03,
336 class Args_04>
337 void emplace(BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
338 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
339 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
340 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04);
341#endif // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 4
342
343#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 5
344 template <class Args_01,
345 class Args_02,
346 class Args_03,
347 class Args_04,
348 class Args_05>
349 void emplace(BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
350 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
351 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
352 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
353 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05);
354#endif // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 5
355
356#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 6
357 template <class Args_01,
358 class Args_02,
359 class Args_03,
360 class Args_04,
361 class Args_05,
362 class Args_06>
363 void emplace(BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
364 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
365 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
366 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
367 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
368 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06);
369#endif // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 6
370
371#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 7
372 template <class Args_01,
373 class Args_02,
374 class Args_03,
375 class Args_04,
376 class Args_05,
377 class Args_06,
378 class Args_07>
379 void emplace(BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
380 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
381 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
382 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
383 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
384 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
385 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07);
386#endif // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 7
387
388#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 8
389 template <class Args_01,
390 class Args_02,
391 class Args_03,
392 class Args_04,
393 class Args_05,
394 class Args_06,
395 class Args_07,
396 class Args_08>
397 void emplace(BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
398 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
399 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
400 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
401 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
402 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
403 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
404 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08);
405#endif // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 8
406
407#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 9
408 template <class Args_01,
409 class Args_02,
410 class Args_03,
411 class Args_04,
412 class Args_05,
413 class Args_06,
414 class Args_07,
415 class Args_08,
416 class Args_09>
417 void emplace(BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
418 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
419 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
420 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
421 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
422 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
423 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
424 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
425 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09);
426#endif // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 9
427
428#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 10
429 template <class Args_01,
430 class Args_02,
431 class Args_03,
432 class Args_04,
433 class Args_05,
434 class Args_06,
435 class Args_07,
436 class Args_08,
437 class Args_09,
438 class Args_10>
439 void emplace(BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
440 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
441 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
442 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
443 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
444 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
445 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
446 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
447 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09,
448 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) args_10);
449#endif // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 10
450
451#else
452// The generated code below is a workaround for the absence of perfect
453// forwarding in some compilers.
454 template <class... Args>
455 void emplace(BSLS_COMPILERFEATURES_FORWARD_REF(Args)... args);
456// }}} END GENERATED CODE
457#endif
458
459 void pop();
460 /// Remove the top element from this @ref priority_queue object that has
461 /// the highest priority. In effect, performs `c.pop_back();`. The
462 /// behavior is undefined if there is currently no elements in this
463 /// object.
464
466 bsl::is_nothrow_swappable<CONTAINER>::value &&
467 bsl::is_nothrow_swappable<COMPARATOR>::value);
468 // Efficiently exchange the value of this object with the value of the
469 // specified 'other' object. In effect, performs 'using bsl::swap;
470 // swap(c, other.c);'.
471
472 // ACCESSORS
473
474 /// Return `true` if this @ref priority_queue object contains no elements,
475 /// and `false` otherwise. In effect, performs `return c.empty();`.
476 bool empty() const;
477
478 /// Return the number of elements in this @ref priority_queue object. In
479 /// effect, performs `return c.size()`.
480 size_type size() const;
481
482 /// Return a reference providing non-modifiable access to the element
483 /// having the highest priority in this @ref priority_queue object. In
484 /// effect, performs `return c.front()`. The behavior is undefined if
485 /// the priority queue is empty.
486 const_reference top() const;
487};
488
489#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
490// CLASS TEMPLATE DEDUCTION GUIDES
491
492/// Deduce the template parameter `VALUE` and `CONTAINER` from the
493/// parameters supplied to the constructor of @ref priority_queue .
494template <
495 class COMPARATOR,
496 class CONTAINER,
497 class = bsl::enable_if_t<!bsl::IsStdAllocator_v<CONTAINER>>
498 >
499priority_queue(COMPARATOR, CONTAINER)
500 -> priority_queue<typename CONTAINER::value_type, CONTAINER, COMPARATOR>;
501
502/// Deduce the template parameters `VALUE`, `CONTAINER` and `COMPARATOR`
503/// from the parameters supplied to the constructor of @ref priority_queue .
504/// This deduction guide does not participate unless the supplied allocator
505/// is convertible to the underlying container's `allocator_type`.
506template <
507 class COMPARATOR,
508 class CONTAINER,
509 class ALLOCATOR,
510 class = bsl::enable_if_t<bsl::uses_allocator_v<CONTAINER, ALLOCATOR>>
511 >
512priority_queue(COMPARATOR, CONTAINER, ALLOCATOR)
513 -> priority_queue<typename CONTAINER::value_type, CONTAINER, COMPARATOR>;
514
515/// Deduce the template parameter `VALUE` from the `value_type` of the
516/// iterators supplied to the constructor of @ref priority_queue .
517template <
518 class INPUT_ITERATOR,
519 class VALUE =
520 typename BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>
521 >
522priority_queue(INPUT_ITERATOR, INPUT_ITERATOR)
523 -> priority_queue<VALUE>;
524
525/// Deduce the template parameter `VALUE` from the `value_type` of the
526/// iterators supplied to the constructor of @ref priority_queue . Deduce the
527/// template parameters `CONTAINER` and `COMPARATOR` from the other
528/// parameters passed to the constructor.
529template <
530 class INPUT_ITERATOR,
531 class COMPARATOR,
532 class CONTAINER,
533 class VALUE =
534 typename BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>
535 >
536priority_queue(INPUT_ITERATOR, INPUT_ITERATOR, COMPARATOR, CONTAINER)
537 -> priority_queue<VALUE, CONTAINER, COMPARATOR>;
538#endif
539
540// FREE FUNCTIONS
541
542/// Exchange the container and comparator of the specified `a` object with
543/// the container and comparator of the specified `b` object.
544template <class VALUE, class CONTAINER, class COMPARATOR>
545void swap(priority_queue<VALUE, CONTAINER, COMPARATOR>& a,
546 priority_queue<VALUE, CONTAINER, COMPARATOR>& b)
548
549// ============================================================================
550// TEMPLATE AND INLINE FUNCTION DEFINITIONS
551// ============================================================================
552
553 // --------------------
554 // class priority_queue
555 // --------------------
556
557// CREATORS
558template <class VALUE, class CONTAINER, class COMPARATOR>
559inline
561{
562}
563
564template <class VALUE, class CONTAINER, class COMPARATOR>
565inline
567 const COMPARATOR& comparator)
568: comp(comparator)
569{
570}
571
572template <class VALUE, class CONTAINER, class COMPARATOR>
573inline
574priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
575 const COMPARATOR& comparator,
576 const CONTAINER& container)
577: c(container)
578, comp(comparator)
579{
580 std::make_heap(c.begin(), c.end(), comp);
581}
582
583template <class VALUE, class CONTAINER, class COMPARATOR>
584inline
585priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
586 const COMPARATOR& comparator,
587 BloombergLP::bslmf::MovableRef<CONTAINER> container)
588: c(MoveUtil::move(container))
589, comp(comparator)
590{
591 std::make_heap(c.begin(), c.end(), comp);
592}
593
594template <class VALUE, class CONTAINER, class COMPARATOR>
595template <class INPUT_ITERATOR>
596inline
597priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
598 INPUT_ITERATOR first,
599 INPUT_ITERATOR last)
600{
601 c.insert(c.end(), first, last);
602 std::make_heap(c.begin(), c.end(), comp);
603}
604
605template <class VALUE, class CONTAINER, class COMPARATOR>
606template <class INPUT_ITERATOR>
607inline
608priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
609 INPUT_ITERATOR first,
610 INPUT_ITERATOR last,
611 const COMPARATOR& comparator,
612 const CONTAINER& container)
613: c(container)
614, comp(comparator)
615{
616 c.insert(c.end(), first, last);
617 std::make_heap(c.begin(), c.end(), comp);
618}
619
620template <class VALUE, class CONTAINER, class COMPARATOR>
621template <class INPUT_ITERATOR>
622inline
623priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
624 INPUT_ITERATOR first,
625 INPUT_ITERATOR last,
626 const COMPARATOR& comparator,
627 BloombergLP::bslmf::MovableRef<CONTAINER> container)
628: c(MoveUtil::move(container))
629, comp(comparator)
630{
631 c.insert(c.end(), first, last);
632 std::make_heap(c.begin(), c.end(), comp);
633}
634
635template <class VALUE, class CONTAINER, class COMPARATOR>
636inline
637priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
638 const priority_queue& original)
639: c(original.c)
640, comp(original.comp)
641{
642}
643
644template <class VALUE, class CONTAINER, class COMPARATOR>
645inline
646priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
647 BloombergLP::bslmf::MovableRef<priority_queue> original)
648: c(MoveUtil::move(MoveUtil::access(original).c))
649, comp(MoveUtil::access(original).comp)
650{
651}
652
653template <class VALUE, class CONTAINER, class COMPARATOR>
654template <class ALLOCATOR>
655inline
656priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
657 const ALLOCATOR& basicAllocator,
658 typename enable_if<
660 ALLOCATOR>::type *)
661: c(basicAllocator)
662, comp(COMPARATOR())
663{
664}
665
666template <class VALUE, class CONTAINER, class COMPARATOR>
667template <class ALLOCATOR>
668inline
669priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
670 const COMPARATOR& comparator,
671 const ALLOCATOR& basicAllocator,
672 typename enable_if<
674 ALLOCATOR>::type *)
675: c(basicAllocator)
676, comp(comparator)
677{
678}
679
680template <class VALUE, class CONTAINER, class COMPARATOR>
681template <class ALLOCATOR>
682inline
683priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
684 const COMPARATOR& comparator,
685 const CONTAINER& container,
686 const ALLOCATOR& basicAllocator,
687 typename enable_if<
689 ALLOCATOR>::type *)
690: c(container, basicAllocator)
691, comp(comparator)
692{
693 std::make_heap(c.begin(), c.end(), comp);
694}
695
696template <class VALUE, class CONTAINER, class COMPARATOR>
697template <class ALLOCATOR>
698inline
699priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
700 const COMPARATOR& comparator,
701 BloombergLP::bslmf::MovableRef<CONTAINER> container,
702 const ALLOCATOR& basicAllocator,
703 typename enable_if<
705 ALLOCATOR>::type *)
706: c(MoveUtil::move(container), basicAllocator)
707, comp(comparator)
708{
709 std::make_heap(c.begin(), c.end(), comp);
710}
711
712template <class VALUE, class CONTAINER, class COMPARATOR>
713template <class ALLOCATOR>
714inline
715priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
716 const priority_queue& original,
717 const ALLOCATOR& basicAllocator,
718 typename enable_if<
720 ALLOCATOR>::type *)
721: c(original.c, basicAllocator)
722, comp(original.comp)
723{
724}
725
726template <class VALUE, class CONTAINER, class COMPARATOR>
727template <class ALLOCATOR>
728inline
729priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
730 BloombergLP::bslmf::MovableRef<priority_queue> original,
731 const ALLOCATOR& basicAllocator,
732 typename enable_if<
734 ALLOCATOR>::type *)
735: c(MoveUtil::move(MoveUtil::access(original).c), basicAllocator)
736, comp(MoveUtil::access(original).comp)
737{
738}
739
740// MANIPULATORS
741template <class VALUE, class CONTAINER, class COMPARATOR>
742inline
743priority_queue<VALUE, CONTAINER, COMPARATOR>&
744priority_queue<VALUE, CONTAINER, COMPARATOR>::operator=(
745 const priority_queue& rhs)
746{
747 c = rhs.c;
748 comp = rhs.comp;
749 return *this;
750}
751
752template <class VALUE, class CONTAINER, class COMPARATOR>
753inline
754priority_queue<VALUE, CONTAINER, COMPARATOR>&
755priority_queue<VALUE, CONTAINER, COMPARATOR>::operator=(
756 BloombergLP::bslmf::MovableRef<priority_queue> rhs)
758{
759 c = MoveUtil::move(MoveUtil::access(rhs).c);
760 comp = MoveUtil::access(rhs).comp;
761 return *this;
762}
763
764template <class VALUE, class CONTAINER, class COMPARATOR>
765inline
766void priority_queue<VALUE, CONTAINER, COMPARATOR>::push(
767 const value_type& value)
768{
769 c.push_back(value);
770 std::push_heap(c.begin(), c.end(), comp);
771}
772
773template <class VALUE, class CONTAINER, class COMPARATOR>
774inline
775void priority_queue<VALUE, CONTAINER, COMPARATOR>::push(
776 BloombergLP::bslmf::MovableRef<value_type> value)
777{
778 c.push_back(MoveUtil::move(value));
779 std::push_heap(c.begin(), c.end(), comp);
780}
781
782#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
783// {{{ BEGIN GENERATED CODE
784// Command line: sim_cpp11_features.pl bslstl_priorityqueue.h
785#ifndef BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT
786#define BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT 10
787#endif
788#ifndef BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B
789#define BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT
790#endif
791#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 0
792template <class VALUE, class CONTAINER, class COMPARATOR>
793inline
794void priority_queue<VALUE, CONTAINER, COMPARATOR>::emplace(
795 )
796{
797 c.emplace_back();
798 std::push_heap(c.begin(), c.end(), comp);
799}
800#endif // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 0
801
802#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 1
803template <class VALUE, class CONTAINER, class COMPARATOR>
804template <class Args_01>
805inline
806void priority_queue<VALUE, CONTAINER, COMPARATOR>::emplace(
807 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01)
808{
809 c.emplace_back(BSLS_COMPILERFEATURES_FORWARD(Args_01,args_01));
810 std::push_heap(c.begin(), c.end(), comp);
811}
812#endif // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 1
813
814#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 2
815template <class VALUE, class CONTAINER, class COMPARATOR>
816template <class Args_01,
817 class Args_02>
818inline
819void priority_queue<VALUE, CONTAINER, COMPARATOR>::emplace(
820 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
821 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02)
822{
823 c.emplace_back(BSLS_COMPILERFEATURES_FORWARD(Args_01,args_01),
824 BSLS_COMPILERFEATURES_FORWARD(Args_02,args_02));
825 std::push_heap(c.begin(), c.end(), comp);
826}
827#endif // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 2
828
829#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 3
830template <class VALUE, class CONTAINER, class COMPARATOR>
831template <class Args_01,
832 class Args_02,
833 class Args_03>
834inline
835void priority_queue<VALUE, CONTAINER, COMPARATOR>::emplace(
836 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
837 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
838 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03)
839{
840 c.emplace_back(BSLS_COMPILERFEATURES_FORWARD(Args_01,args_01),
841 BSLS_COMPILERFEATURES_FORWARD(Args_02,args_02),
842 BSLS_COMPILERFEATURES_FORWARD(Args_03,args_03));
843 std::push_heap(c.begin(), c.end(), comp);
844}
845#endif // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 3
846
847#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 4
848template <class VALUE, class CONTAINER, class COMPARATOR>
849template <class Args_01,
850 class Args_02,
851 class Args_03,
852 class Args_04>
853inline
854void priority_queue<VALUE, CONTAINER, COMPARATOR>::emplace(
855 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
856 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
857 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
858 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04)
859{
860 c.emplace_back(BSLS_COMPILERFEATURES_FORWARD(Args_01,args_01),
861 BSLS_COMPILERFEATURES_FORWARD(Args_02,args_02),
862 BSLS_COMPILERFEATURES_FORWARD(Args_03,args_03),
863 BSLS_COMPILERFEATURES_FORWARD(Args_04,args_04));
864 std::push_heap(c.begin(), c.end(), comp);
865}
866#endif // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 4
867
868#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 5
869template <class VALUE, class CONTAINER, class COMPARATOR>
870template <class Args_01,
871 class Args_02,
872 class Args_03,
873 class Args_04,
874 class Args_05>
875inline
876void priority_queue<VALUE, CONTAINER, COMPARATOR>::emplace(
877 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
878 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
879 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
880 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
881 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05)
882{
883 c.emplace_back(BSLS_COMPILERFEATURES_FORWARD(Args_01,args_01),
884 BSLS_COMPILERFEATURES_FORWARD(Args_02,args_02),
885 BSLS_COMPILERFEATURES_FORWARD(Args_03,args_03),
886 BSLS_COMPILERFEATURES_FORWARD(Args_04,args_04),
887 BSLS_COMPILERFEATURES_FORWARD(Args_05,args_05));
888 std::push_heap(c.begin(), c.end(), comp);
889}
890#endif // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 5
891
892#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 6
893template <class VALUE, class CONTAINER, class COMPARATOR>
894template <class Args_01,
895 class Args_02,
896 class Args_03,
897 class Args_04,
898 class Args_05,
899 class Args_06>
900inline
901void priority_queue<VALUE, CONTAINER, COMPARATOR>::emplace(
902 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
903 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
904 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
905 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
906 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
907 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06)
908{
909 c.emplace_back(BSLS_COMPILERFEATURES_FORWARD(Args_01,args_01),
910 BSLS_COMPILERFEATURES_FORWARD(Args_02,args_02),
911 BSLS_COMPILERFEATURES_FORWARD(Args_03,args_03),
912 BSLS_COMPILERFEATURES_FORWARD(Args_04,args_04),
913 BSLS_COMPILERFEATURES_FORWARD(Args_05,args_05),
914 BSLS_COMPILERFEATURES_FORWARD(Args_06,args_06));
915 std::push_heap(c.begin(), c.end(), comp);
916}
917#endif // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 6
918
919#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 7
920template <class VALUE, class CONTAINER, class COMPARATOR>
921template <class Args_01,
922 class Args_02,
923 class Args_03,
924 class Args_04,
925 class Args_05,
926 class Args_06,
927 class Args_07>
928inline
929void priority_queue<VALUE, CONTAINER, COMPARATOR>::emplace(
930 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
931 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
932 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
933 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
934 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
935 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
936 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07)
937{
938 c.emplace_back(BSLS_COMPILERFEATURES_FORWARD(Args_01,args_01),
939 BSLS_COMPILERFEATURES_FORWARD(Args_02,args_02),
940 BSLS_COMPILERFEATURES_FORWARD(Args_03,args_03),
941 BSLS_COMPILERFEATURES_FORWARD(Args_04,args_04),
942 BSLS_COMPILERFEATURES_FORWARD(Args_05,args_05),
943 BSLS_COMPILERFEATURES_FORWARD(Args_06,args_06),
944 BSLS_COMPILERFEATURES_FORWARD(Args_07,args_07));
945 std::push_heap(c.begin(), c.end(), comp);
946}
947#endif // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 7
948
949#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 8
950template <class VALUE, class CONTAINER, class COMPARATOR>
951template <class Args_01,
952 class Args_02,
953 class Args_03,
954 class Args_04,
955 class Args_05,
956 class Args_06,
957 class Args_07,
958 class Args_08>
959inline
960void priority_queue<VALUE, CONTAINER, COMPARATOR>::emplace(
961 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
962 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
963 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
964 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
965 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
966 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
967 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
968 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08)
969{
970 c.emplace_back(BSLS_COMPILERFEATURES_FORWARD(Args_01,args_01),
971 BSLS_COMPILERFEATURES_FORWARD(Args_02,args_02),
972 BSLS_COMPILERFEATURES_FORWARD(Args_03,args_03),
973 BSLS_COMPILERFEATURES_FORWARD(Args_04,args_04),
974 BSLS_COMPILERFEATURES_FORWARD(Args_05,args_05),
975 BSLS_COMPILERFEATURES_FORWARD(Args_06,args_06),
976 BSLS_COMPILERFEATURES_FORWARD(Args_07,args_07),
977 BSLS_COMPILERFEATURES_FORWARD(Args_08,args_08));
978 std::push_heap(c.begin(), c.end(), comp);
979}
980#endif // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 8
981
982#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 9
983template <class VALUE, class CONTAINER, class COMPARATOR>
984template <class Args_01,
985 class Args_02,
986 class Args_03,
987 class Args_04,
988 class Args_05,
989 class Args_06,
990 class Args_07,
991 class Args_08,
992 class Args_09>
993inline
994void priority_queue<VALUE, CONTAINER, COMPARATOR>::emplace(
995 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
996 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
997 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
998 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
999 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1000 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
1001 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
1002 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
1003 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09)
1004{
1005 c.emplace_back(BSLS_COMPILERFEATURES_FORWARD(Args_01,args_01),
1006 BSLS_COMPILERFEATURES_FORWARD(Args_02,args_02),
1007 BSLS_COMPILERFEATURES_FORWARD(Args_03,args_03),
1008 BSLS_COMPILERFEATURES_FORWARD(Args_04,args_04),
1009 BSLS_COMPILERFEATURES_FORWARD(Args_05,args_05),
1010 BSLS_COMPILERFEATURES_FORWARD(Args_06,args_06),
1011 BSLS_COMPILERFEATURES_FORWARD(Args_07,args_07),
1012 BSLS_COMPILERFEATURES_FORWARD(Args_08,args_08),
1013 BSLS_COMPILERFEATURES_FORWARD(Args_09,args_09));
1014 std::push_heap(c.begin(), c.end(), comp);
1015}
1016#endif // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 9
1017
1018#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 10
1019template <class VALUE, class CONTAINER, class COMPARATOR>
1020template <class Args_01,
1021 class Args_02,
1022 class Args_03,
1023 class Args_04,
1024 class Args_05,
1025 class Args_06,
1026 class Args_07,
1027 class Args_08,
1028 class Args_09,
1029 class Args_10>
1030inline
1031void priority_queue<VALUE, CONTAINER, COMPARATOR>::emplace(
1032 BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
1033 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
1034 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
1035 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
1036 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
1037 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
1038 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
1039 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
1040 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09,
1041 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) args_10)
1042{
1043 c.emplace_back(BSLS_COMPILERFEATURES_FORWARD(Args_01,args_01),
1044 BSLS_COMPILERFEATURES_FORWARD(Args_02,args_02),
1045 BSLS_COMPILERFEATURES_FORWARD(Args_03,args_03),
1046 BSLS_COMPILERFEATURES_FORWARD(Args_04,args_04),
1047 BSLS_COMPILERFEATURES_FORWARD(Args_05,args_05),
1048 BSLS_COMPILERFEATURES_FORWARD(Args_06,args_06),
1049 BSLS_COMPILERFEATURES_FORWARD(Args_07,args_07),
1050 BSLS_COMPILERFEATURES_FORWARD(Args_08,args_08),
1051 BSLS_COMPILERFEATURES_FORWARD(Args_09,args_09),
1052 BSLS_COMPILERFEATURES_FORWARD(Args_10,args_10));
1053 std::push_heap(c.begin(), c.end(), comp);
1054}
1055#endif // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 10
1056
1057#else
1058// The generated code below is a workaround for the absence of perfect
1059// forwarding in some compilers.
1060template <class VALUE, class CONTAINER, class COMPARATOR>
1061template <class... Args>
1062inline
1063void priority_queue<VALUE, CONTAINER, COMPARATOR>::emplace(
1065{
1066 c.emplace_back(BSLS_COMPILERFEATURES_FORWARD(Args,args)...);
1067 std::push_heap(c.begin(), c.end(), comp);
1068}
1069// }}} END GENERATED CODE
1070#endif
1071
1072template <class VALUE, class CONTAINER, class COMPARATOR>
1073inline
1074void priority_queue<VALUE, CONTAINER, COMPARATOR>::pop()
1075{
1076 std::pop_heap(c.begin(), c.end(), comp);
1077 c.pop_back();
1078}
1079
1080template <class VALUE, class CONTAINER, class COMPARATOR>
1081inline
1082void priority_queue<VALUE, CONTAINER, COMPARATOR>::swap(priority_queue& other)
1084 bsl::is_nothrow_swappable<CONTAINER>::value &&
1085 bsl::is_nothrow_swappable<COMPARATOR>::value)
1086{
1087 BloombergLP::bslalg::SwapUtil::swap(&c, &other.c);
1088 BloombergLP::bslalg::SwapUtil::swap(&comp, &other.comp);
1089}
1090
1091// ACCESSORS
1092template <class VALUE, class CONTAINER, class COMPARATOR>
1093inline
1094bool priority_queue<VALUE, CONTAINER, COMPARATOR>::empty() const
1095{
1096 return c.empty();
1097}
1098
1099template <class VALUE, class CONTAINER, class COMPARATOR>
1100inline
1101typename priority_queue<VALUE, CONTAINER, COMPARATOR>::size_type
1102priority_queue<VALUE, CONTAINER, COMPARATOR>::size() const
1103{
1104 return c.size();
1105}
1106
1107template <class VALUE, class CONTAINER, class COMPARATOR>
1108inline
1109typename priority_queue<VALUE, CONTAINER, COMPARATOR>::const_reference
1110priority_queue<VALUE, CONTAINER, COMPARATOR>::top() const
1111{
1112 return c.front();
1113}
1114
1115// FREE FUNCTIONS
1116template <class VALUE, class CONTAINER, class COMPARATOR>
1117void swap(priority_queue<VALUE, CONTAINER, COMPARATOR>& a,
1118 priority_queue<VALUE, CONTAINER, COMPARATOR>& b)
1120{
1121 a.swap(b);
1122}
1123
1124} // close namespace bsl
1125
1126#else // if ! defined(DEFINED_BSLSTL_PRIORITYQUEUE_H)
1127# error Not valid except when included from bslstl_priorityqueue.h
1128#endif // ! defined(COMPILING_BSLSTL_PRIORITYQUEUE_H)
1129
1130#endif // ! defined(INCLUDED_BSLSTL_PRIORITYQUEUE_CPP03)
1131
1132// ----------------------------------------------------------------------------
1133// Copyright 2016 Bloomberg Finance L.P.
1134//
1135// Licensed under the Apache License, Version 2.0 (the "License");
1136// you may not use this file except in compliance with the License.
1137// You may obtain a copy of the License at
1138//
1139// http://www.apache.org/licenses/LICENSE-2.0
1140//
1141// Unless required by applicable law or agreed to in writing, software
1142// distributed under the License is distributed on an "AS IS" BASIS,
1143// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1144// See the License for the specific language governing permissions and
1145// limitations under the License.
1146// ----------------------------- END-OF-FILE ----------------------------------
1147
1148/** @} */
1149/** @} */
1150/** @} */
#define BSLMF_NESTED_TRAIT_DECLARATION_IF(t_TYPE, t_TRAIT, t_COND)
Definition bslmf_nestedtraitdeclaration.h:243
size_type size() const
Definition bslstl_priorityqueue.h:1018
void emplace(Args &&... args)
Definition bslstl_priorityqueue.h:981
void pop()
Definition bslstl_priorityqueue.h:990
void swap(priority_queue &other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(bsl bool empty() const
Definition bslstl_priorityqueue.h:671
COMPARATOR value_compare
Definition bslstl_priorityqueue.h:447
CONTAINER::reference reference
Definition bslstl_priorityqueue.h:449
COMPARATOR comp
Definition bslstl_priorityqueue.h:459
CONTAINER::size_type size_type
Definition bslstl_priorityqueue.h:451
priority_queue()
Definition bslstl_priorityqueue.h:755
CONTAINER::const_reference const_reference
Definition bslstl_priorityqueue.h:450
CONTAINER c
Definition bslstl_priorityqueue.h:455
CONTAINER::value_type value_type
Definition bslstl_priorityqueue.h:448
void push(const value_type &value)
Definition bslstl_priorityqueue.h:961
const_reference top() const
Definition bslstl_priorityqueue.h:1026
CONTAINER container_type
Definition bslstl_priorityqueue.h:446
priority_queue & operator=(const priority_queue &rhs)
Definition bslstl_priorityqueue.h:939
#define BSLMF_ASSERT(expr)
Definition bslmf_assert.h:229
static const t_TYPE value
Definition bslmf_integralconstant.h:258
#define BSLS_COMPILERFEATURES_FORWARD_REF(T)
Definition bsls_compilerfeatures.h:2012
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2018
#define BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(...)
Definition bsls_keyword.h:634
void swap(OptionValue &a, OptionValue &b)
Definition bdlb_printmethods.h:283
Definition bslmf_usesallocator.h:165