libstdc++
stl_queue.h
Go to the documentation of this file.
1 // Queue implementation -*- C++ -*-
2 
3 // Copyright (C) 2001-2016 Free Software Foundation, Inc.
4 //
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
9 // any later version.
10 
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 
16 // Under Section 7 of GPL version 3, you are granted additional
17 // permissions described in the GCC Runtime Library Exception, version
18 // 3.1, as published by the Free Software Foundation.
19 
20 // You should have received a copy of the GNU General Public License and
21 // a copy of the GCC Runtime Library Exception along with this program;
22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 // <http://www.gnu.org/licenses/>.
24 
25 /*
26  *
27  * Copyright (c) 1994
28  * Hewlett-Packard Company
29  *
30  * Permission to use, copy, modify, distribute and sell this software
31  * and its documentation for any purpose is hereby granted without fee,
32  * provided that the above copyright notice appear in all copies and
33  * that both that copyright notice and this permission notice appear
34  * in supporting documentation. Hewlett-Packard Company makes no
35  * representations about the suitability of this software for any
36  * purpose. It is provided "as is" without express or implied warranty.
37  *
38  *
39  * Copyright (c) 1996,1997
40  * Silicon Graphics Computer Systems, Inc.
41  *
42  * Permission to use, copy, modify, distribute and sell this software
43  * and its documentation for any purpose is hereby granted without fee,
44  * provided that the above copyright notice appear in all copies and
45  * that both that copyright notice and this permission notice appear
46  * in supporting documentation. Silicon Graphics makes no
47  * representations about the suitability of this software for any
48  * purpose. It is provided "as is" without express or implied warranty.
49  */
50 
51 /** @file bits/stl_queue.h
52  * This is an internal header file, included by other library headers.
53  * Do not attempt to use it directly. @headername{queue}
54  */
55 
56 #ifndef _STL_QUEUE_H
57 #define _STL_QUEUE_H 1
58 
59 #include <bits/concept_check.h>
60 #include <debug/debug.h>
61 #if __cplusplus >= 201103L
62 # include <bits/uses_allocator.h>
63 #endif
64 
65 namespace std _GLIBCXX_VISIBILITY(default)
66 {
67 _GLIBCXX_BEGIN_NAMESPACE_VERSION
68 
69  /**
70  * @brief A standard container giving FIFO behavior.
71  *
72  * @ingroup sequences
73  *
74  * @tparam _Tp Type of element.
75  * @tparam _Sequence Type of underlying sequence, defaults to deque<_Tp>.
76  *
77  * Meets many of the requirements of a
78  * <a href="tables.html#65">container</a>,
79  * but does not define anything to do with iterators. Very few of the
80  * other standard container interfaces are defined.
81  *
82  * This is not a true container, but an @e adaptor. It holds another
83  * container, and provides a wrapper interface to that container. The
84  * wrapper is what enforces strict first-in-first-out %queue behavior.
85  *
86  * The second template parameter defines the type of the underlying
87  * sequence/container. It defaults to std::deque, but it can be any type
88  * that supports @c front, @c back, @c push_back, and @c pop_front,
89  * such as std::list or an appropriate user-defined type.
90  *
91  * Members not found in @a normal containers are @c container_type,
92  * which is a typedef for the second Sequence parameter, and @c push and
93  * @c pop, which are standard %queue/FIFO operations.
94  */
95  template<typename _Tp, typename _Sequence = deque<_Tp> >
96  class queue
97  {
98  // concept requirements
99  typedef typename _Sequence::value_type _Sequence_value_type;
100  __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
101  __glibcxx_class_requires(_Sequence, _FrontInsertionSequenceConcept)
102  __glibcxx_class_requires(_Sequence, _BackInsertionSequenceConcept)
103  __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
104 
105  template<typename _Tp1, typename _Seq1>
106  friend bool
107  operator==(const queue<_Tp1, _Seq1>&, const queue<_Tp1, _Seq1>&);
108 
109  template<typename _Tp1, typename _Seq1>
110  friend bool
111  operator<(const queue<_Tp1, _Seq1>&, const queue<_Tp1, _Seq1>&);
112 
113 #if __cplusplus >= 201103L
114  template<typename _Alloc>
115  using _Uses = typename
116  enable_if<uses_allocator<_Sequence, _Alloc>::value>::type;
117 #endif
118 
119  public:
120  typedef typename _Sequence::value_type value_type;
121  typedef typename _Sequence::reference reference;
122  typedef typename _Sequence::const_reference const_reference;
123  typedef typename _Sequence::size_type size_type;
124  typedef _Sequence container_type;
125 
126  protected:
127  /**
128  * 'c' is the underlying container. Maintainers wondering why
129  * this isn't uglified as per style guidelines should note that
130  * this name is specified in the standard, [23.2.3.1]. (Why?
131  * Presumably for the same reason that it's protected instead
132  * of private: to allow derivation. But none of the other
133  * containers allow for derivation. Odd.)
134  */
135  _Sequence c;
136 
137  public:
138  /**
139  * @brief Default constructor creates no elements.
140  */
141 #if __cplusplus < 201103L
142  explicit
143  queue(const _Sequence& __c = _Sequence())
144  : c(__c) { }
145 #else
146  explicit
147  queue(const _Sequence& __c)
148  : c(__c) { }
149 
150  explicit
151  queue(_Sequence&& __c = _Sequence())
152  : c(std::move(__c)) { }
153 
154  template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
155  explicit
156  queue(const _Alloc& __a)
157  : c(__a) { }
158 
159  template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
160  queue(const _Sequence& __c, const _Alloc& __a)
161  : c(__c, __a) { }
162 
163  template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
164  queue(_Sequence&& __c, const _Alloc& __a)
165  : c(std::move(__c), __a) { }
166 
167  template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
168  queue(const queue& __q, const _Alloc& __a)
169  : c(__q.c, __a) { }
170 
171  template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
172  queue(queue&& __q, const _Alloc& __a)
173  : c(std::move(__q.c), __a) { }
174 #endif
175 
176  /**
177  * Returns true if the %queue is empty.
178  */
179  bool
180  empty() const
181  { return c.empty(); }
182 
183  /** Returns the number of elements in the %queue. */
184  size_type
185  size() const
186  { return c.size(); }
187 
188  /**
189  * Returns a read/write reference to the data at the first
190  * element of the %queue.
191  */
192  reference
194  {
195  __glibcxx_requires_nonempty();
196  return c.front();
197  }
198 
199  /**
200  * Returns a read-only (constant) reference to the data at the first
201  * element of the %queue.
202  */
203  const_reference
204  front() const
205  {
206  __glibcxx_requires_nonempty();
207  return c.front();
208  }
209 
210  /**
211  * Returns a read/write reference to the data at the last
212  * element of the %queue.
213  */
214  reference
216  {
217  __glibcxx_requires_nonempty();
218  return c.back();
219  }
220 
221  /**
222  * Returns a read-only (constant) reference to the data at the last
223  * element of the %queue.
224  */
225  const_reference
226  back() const
227  {
228  __glibcxx_requires_nonempty();
229  return c.back();
230  }
231 
232  /**
233  * @brief Add data to the end of the %queue.
234  * @param __x Data to be added.
235  *
236  * This is a typical %queue operation. The function creates an
237  * element at the end of the %queue and assigns the given data
238  * to it. The time complexity of the operation depends on the
239  * underlying sequence.
240  */
241  void
242  push(const value_type& __x)
243  { c.push_back(__x); }
244 
245 #if __cplusplus >= 201103L
246  void
247  push(value_type&& __x)
248  { c.push_back(std::move(__x)); }
249 
250 #if __cplusplus > 201402L
251  template<typename... _Args>
252  decltype(auto)
253  emplace(_Args&&... __args)
254  { return c.emplace_back(std::forward<_Args>(__args)...); }
255 #else
256  template<typename... _Args>
257  void
258  emplace(_Args&&... __args)
259  { c.emplace_back(std::forward<_Args>(__args)...); }
260 #endif
261 #endif
262 
263  /**
264  * @brief Removes first element.
265  *
266  * This is a typical %queue operation. It shrinks the %queue by one.
267  * The time complexity of the operation depends on the underlying
268  * sequence.
269  *
270  * Note that no data is returned, and if the first element's
271  * data is needed, it should be retrieved before pop() is
272  * called.
273  */
274  void
275  pop()
276  {
277  __glibcxx_requires_nonempty();
278  c.pop_front();
279  }
280 
281 #if __cplusplus >= 201103L
282  void
283  swap(queue& __q)
284 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
285  noexcept(__is_nothrow_swappable<_Sequence>::value)
286 #else
287  noexcept(__is_nothrow_swappable<_Tp>::value)
288 #endif
289  {
290  using std::swap;
291  swap(c, __q.c);
292  }
293 #endif // __cplusplus >= 201103L
294  };
295 
296  /**
297  * @brief Queue equality comparison.
298  * @param __x A %queue.
299  * @param __y A %queue of the same type as @a __x.
300  * @return True iff the size and elements of the queues are equal.
301  *
302  * This is an equivalence relation. Complexity and semantics depend on the
303  * underlying sequence type, but the expected rules are: this relation is
304  * linear in the size of the sequences, and queues are considered equivalent
305  * if their sequences compare equal.
306  */
307  template<typename _Tp, typename _Seq>
308  inline bool
309  operator==(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
310  { return __x.c == __y.c; }
311 
312  /**
313  * @brief Queue ordering relation.
314  * @param __x A %queue.
315  * @param __y A %queue of the same type as @a x.
316  * @return True iff @a __x is lexicographically less than @a __y.
317  *
318  * This is an total ordering relation. Complexity and semantics
319  * depend on the underlying sequence type, but the expected rules
320  * are: this relation is linear in the size of the sequences, the
321  * elements must be comparable with @c <, and
322  * std::lexicographical_compare() is usually used to make the
323  * determination.
324  */
325  template<typename _Tp, typename _Seq>
326  inline bool
327  operator<(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
328  { return __x.c < __y.c; }
329 
330  /// Based on operator==
331  template<typename _Tp, typename _Seq>
332  inline bool
333  operator!=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
334  { return !(__x == __y); }
335 
336  /// Based on operator<
337  template<typename _Tp, typename _Seq>
338  inline bool
339  operator>(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
340  { return __y < __x; }
341 
342  /// Based on operator<
343  template<typename _Tp, typename _Seq>
344  inline bool
345  operator<=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
346  { return !(__y < __x); }
347 
348  /// Based on operator<
349  template<typename _Tp, typename _Seq>
350  inline bool
351  operator>=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
352  { return !(__x < __y); }
353 
354 #if __cplusplus >= 201103L
355  template<typename _Tp, typename _Seq>
356  inline
357 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
358  // Constrained free swap overload, see p0185r1
359  typename enable_if<__is_swappable<_Seq>::value>::type
360 #else
361  void
362 #endif
363  swap(queue<_Tp, _Seq>& __x, queue<_Tp, _Seq>& __y)
364  noexcept(noexcept(__x.swap(__y)))
365  { __x.swap(__y); }
366 
367  template<typename _Tp, typename _Seq, typename _Alloc>
368  struct uses_allocator<queue<_Tp, _Seq>, _Alloc>
369  : public uses_allocator<_Seq, _Alloc>::type { };
370 #endif // __cplusplus >= 201103L
371 
372  /**
373  * @brief A standard container automatically sorting its contents.
374  *
375  * @ingroup sequences
376  *
377  * @tparam _Tp Type of element.
378  * @tparam _Sequence Type of underlying sequence, defaults to vector<_Tp>.
379  * @tparam _Compare Comparison function object type, defaults to
380  * less<_Sequence::value_type>.
381  *
382  * This is not a true container, but an @e adaptor. It holds
383  * another container, and provides a wrapper interface to that
384  * container. The wrapper is what enforces priority-based sorting
385  * and %queue behavior. Very few of the standard container/sequence
386  * interface requirements are met (e.g., iterators).
387  *
388  * The second template parameter defines the type of the underlying
389  * sequence/container. It defaults to std::vector, but it can be
390  * any type that supports @c front(), @c push_back, @c pop_back,
391  * and random-access iterators, such as std::deque or an
392  * appropriate user-defined type.
393  *
394  * The third template parameter supplies the means of making
395  * priority comparisons. It defaults to @c less<value_type> but
396  * can be anything defining a strict weak ordering.
397  *
398  * Members not found in @a normal containers are @c container_type,
399  * which is a typedef for the second Sequence parameter, and @c
400  * push, @c pop, and @c top, which are standard %queue operations.
401  *
402  * @note No equality/comparison operators are provided for
403  * %priority_queue.
404  *
405  * @note Sorting of the elements takes place as they are added to,
406  * and removed from, the %priority_queue using the
407  * %priority_queue's member functions. If you access the elements
408  * by other means, and change their data such that the sorting
409  * order would be different, the %priority_queue will not re-sort
410  * the elements for you. (How could it know to do so?)
411  */
412  template<typename _Tp, typename _Sequence = vector<_Tp>,
413  typename _Compare = less<typename _Sequence::value_type> >
415  {
416  // concept requirements
417  typedef typename _Sequence::value_type _Sequence_value_type;
418  __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
419  __glibcxx_class_requires(_Sequence, _SequenceConcept)
420  __glibcxx_class_requires(_Sequence, _RandomAccessContainerConcept)
421  __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
422  __glibcxx_class_requires4(_Compare, bool, _Tp, _Tp,
423  _BinaryFunctionConcept)
424 
425 #if __cplusplus >= 201103L
426  template<typename _Alloc>
427  using _Uses = typename
428  enable_if<uses_allocator<_Sequence, _Alloc>::value>::type;
429 #endif
430 
431  public:
432  typedef typename _Sequence::value_type value_type;
433  typedef typename _Sequence::reference reference;
434  typedef typename _Sequence::const_reference const_reference;
435  typedef typename _Sequence::size_type size_type;
436  typedef _Sequence container_type;
437  // _GLIBCXX_RESOLVE_LIB_DEFECTS
438  // DR 2684. priority_queue lacking comparator typedef
439  typedef _Compare value_compare;
440 
441  protected:
442  // See queue::c for notes on these names.
443  _Sequence c;
444  _Compare comp;
445 
446  public:
447  /**
448  * @brief Default constructor creates no elements.
449  */
450 #if __cplusplus < 201103L
451  explicit
452  priority_queue(const _Compare& __x = _Compare(),
453  const _Sequence& __s = _Sequence())
454  : c(__s), comp(__x)
455  { std::make_heap(c.begin(), c.end(), comp); }
456 #else
457  explicit
458  priority_queue(const _Compare& __x,
459  const _Sequence& __s)
460  : c(__s), comp(__x)
461  { std::make_heap(c.begin(), c.end(), comp); }
462 
463  explicit
464  priority_queue(const _Compare& __x = _Compare(),
465  _Sequence&& __s = _Sequence())
466  : c(std::move(__s)), comp(__x)
467  { std::make_heap(c.begin(), c.end(), comp); }
468 
469  template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
470  explicit
471  priority_queue(const _Alloc& __a)
472  : c(__a), comp() { }
473 
474  template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
475  priority_queue(const _Compare& __x, const _Alloc& __a)
476  : c(__a), comp(__x) { }
477 
478  template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
479  priority_queue(const _Compare& __x, const _Sequence& __c,
480  const _Alloc& __a)
481  : c(__c, __a), comp(__x) { }
482 
483  template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
484  priority_queue(const _Compare& __x, _Sequence&& __c, const _Alloc& __a)
485  : c(std::move(__c), __a), comp(__x) { }
486 
487  template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
488  priority_queue(const priority_queue& __q, const _Alloc& __a)
489  : c(__q.c, __a), comp(__q.comp) { }
490 
491  template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
492  priority_queue(priority_queue&& __q, const _Alloc& __a)
493  : c(std::move(__q.c), __a), comp(std::move(__q.comp)) { }
494 #endif
495 
496  /**
497  * @brief Builds a %queue from a range.
498  * @param __first An input iterator.
499  * @param __last An input iterator.
500  * @param __x A comparison functor describing a strict weak ordering.
501  * @param __s An initial sequence with which to start.
502  *
503  * Begins by copying @a __s, inserting a copy of the elements
504  * from @a [first,last) into the copy of @a __s, then ordering
505  * the copy according to @a __x.
506  *
507  * For more information on function objects, see the
508  * documentation on @link functors functor base
509  * classes@endlink.
510  */
511 #if __cplusplus < 201103L
512  template<typename _InputIterator>
513  priority_queue(_InputIterator __first, _InputIterator __last,
514  const _Compare& __x = _Compare(),
515  const _Sequence& __s = _Sequence())
516  : c(__s), comp(__x)
517  {
518  __glibcxx_requires_valid_range(__first, __last);
519  c.insert(c.end(), __first, __last);
520  std::make_heap(c.begin(), c.end(), comp);
521  }
522 #else
523  template<typename _InputIterator>
524  priority_queue(_InputIterator __first, _InputIterator __last,
525  const _Compare& __x,
526  const _Sequence& __s)
527  : c(__s), comp(__x)
528  {
529  __glibcxx_requires_valid_range(__first, __last);
530  c.insert(c.end(), __first, __last);
531  std::make_heap(c.begin(), c.end(), comp);
532  }
533 
534  template<typename _InputIterator>
535  priority_queue(_InputIterator __first, _InputIterator __last,
536  const _Compare& __x = _Compare(),
537  _Sequence&& __s = _Sequence())
538  : c(std::move(__s)), comp(__x)
539  {
540  __glibcxx_requires_valid_range(__first, __last);
541  c.insert(c.end(), __first, __last);
542  std::make_heap(c.begin(), c.end(), comp);
543  }
544 #endif
545 
546  /**
547  * Returns true if the %queue is empty.
548  */
549  bool
550  empty() const
551  { return c.empty(); }
552 
553  /** Returns the number of elements in the %queue. */
554  size_type
555  size() const
556  { return c.size(); }
557 
558  /**
559  * Returns a read-only (constant) reference to the data at the first
560  * element of the %queue.
561  */
562  const_reference
563  top() const
564  {
565  __glibcxx_requires_nonempty();
566  return c.front();
567  }
568 
569  /**
570  * @brief Add data to the %queue.
571  * @param __x Data to be added.
572  *
573  * This is a typical %queue operation.
574  * The time complexity of the operation depends on the underlying
575  * sequence.
576  */
577  void
578  push(const value_type& __x)
579  {
580  c.push_back(__x);
581  std::push_heap(c.begin(), c.end(), comp);
582  }
583 
584 #if __cplusplus >= 201103L
585  void
586  push(value_type&& __x)
587  {
588  c.push_back(std::move(__x));
589  std::push_heap(c.begin(), c.end(), comp);
590  }
591 
592  template<typename... _Args>
593  void
594  emplace(_Args&&... __args)
595  {
596  c.emplace_back(std::forward<_Args>(__args)...);
597  std::push_heap(c.begin(), c.end(), comp);
598  }
599 #endif
600 
601  /**
602  * @brief Removes first element.
603  *
604  * This is a typical %queue operation. It shrinks the %queue
605  * by one. The time complexity of the operation depends on the
606  * underlying sequence.
607  *
608  * Note that no data is returned, and if the first element's
609  * data is needed, it should be retrieved before pop() is
610  * called.
611  */
612  void
613  pop()
614  {
615  __glibcxx_requires_nonempty();
616  std::pop_heap(c.begin(), c.end(), comp);
617  c.pop_back();
618  }
619 
620 #if __cplusplus >= 201103L
621  void
622  swap(priority_queue& __pq)
623  noexcept(__and_<
624 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
625  __is_nothrow_swappable<_Sequence>,
626 #else
627  __is_nothrow_swappable<_Tp>,
628 #endif
629  __is_nothrow_swappable<_Compare>
630  >::value)
631  {
632  using std::swap;
633  swap(c, __pq.c);
634  swap(comp, __pq.comp);
635  }
636 #endif // __cplusplus >= 201103L
637  };
638 
639  // No equality/comparison operators are provided for priority_queue.
640 
641 #if __cplusplus >= 201103L
642  template<typename _Tp, typename _Sequence, typename _Compare>
643  inline
644 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
645  // Constrained free swap overload, see p0185r1
646  typename enable_if<__and_<__is_swappable<_Sequence>,
647  __is_swappable<_Compare>>::value>::type
648 #else
649  void
650 #endif
653  noexcept(noexcept(__x.swap(__y)))
654  { __x.swap(__y); }
655 
656  template<typename _Tp, typename _Sequence, typename _Compare,
657  typename _Alloc>
658  struct uses_allocator<priority_queue<_Tp, _Sequence, _Compare>, _Alloc>
659  : public uses_allocator<_Sequence, _Alloc>::type { };
660 #endif // __cplusplus >= 201103L
661 
662 _GLIBCXX_END_NAMESPACE_VERSION
663 } // namespace
664 
665 #endif /* _STL_QUEUE_H */
const_reference front() const
Definition: stl_queue.h:204
void push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
Push an element onto a heap using comparison functor.
Definition: stl_heap.h:185
reference back()
Definition: stl_queue.h:215
size_type size() const
Definition: stl_queue.h:185
ISO C++ entities toplevel namespace is std.
bool empty() const
Definition: stl_queue.h:550
queue(const _Sequence &__c)
Default constructor creates no elements.
Definition: stl_queue.h:147
const_reference back() const
Definition: stl_queue.h:226
A standard container giving FIFO behavior.
Definition: stl_queue.h:96
void push(const value_type &__x)
Add data to the queue.
Definition: stl_queue.h:578
void pop()
Removes first element.
Definition: stl_queue.h:613
A standard container automatically sorting its contents.
Definition: stl_queue.h:414
void make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
Construct a heap over a range using comparison functor.
Definition: stl_heap.h:379
size_type size() const
Definition: stl_queue.h:555
Declare uses_allocator so it can be specialized in <queue> etc.
Definition: memoryfwd.h:71
reference front()
Definition: stl_queue.h:193
void push(const value_type &__x)
Add data to the end of the queue.
Definition: stl_queue.h:242
const_reference top() const
Definition: stl_queue.h:563
_Sequence c
Definition: stl_queue.h:135
void pop()
Removes first element.
Definition: stl_queue.h:275
priority_queue(_InputIterator __first, _InputIterator __last, const _Compare &__x, const _Sequence &__s)
Builds a queue from a range.
Definition: stl_queue.h:524
priority_queue(const _Compare &__x, const _Sequence &__s)
Default constructor creates no elements.
Definition: stl_queue.h:458
void pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
Pop an element off a heap using comparison functor.
Definition: stl_heap.h:298
bool empty() const
Definition: stl_queue.h:180