libstdc++
stl_queue.h
Go to the documentation of this file.
1 // Queue implementation -*- C++ -*-
2 
3 // Copyright (C) 2001-2017 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  /* Maintainers wondering why this isn't uglified as per style
128  * guidelines should note that this name is specified in the standard,
129  * C++98 [23.2.3.1].
130  * (Why? Presumably for the same reason that it's protected instead
131  * of private: to allow derivation. But none of the other
132  * containers allow for derivation. Odd.)
133  */
134  /// @c c is the underlying container.
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  template<typename _Seq = _Sequence, typename _Requires = typename
147  enable_if<is_default_constructible<_Seq>::value>::type>
149  : c() { }
150 
151  explicit
152  queue(const _Sequence& __c)
153  : c(__c) { }
154 
155  explicit
156  queue(_Sequence&& __c)
157  : c(std::move(__c)) { }
158 
159  template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
160  explicit
161  queue(const _Alloc& __a)
162  : c(__a) { }
163 
164  template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
165  queue(const _Sequence& __c, const _Alloc& __a)
166  : c(__c, __a) { }
167 
168  template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
169  queue(_Sequence&& __c, const _Alloc& __a)
170  : c(std::move(__c), __a) { }
171 
172  template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
173  queue(const queue& __q, const _Alloc& __a)
174  : c(__q.c, __a) { }
175 
176  template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
177  queue(queue&& __q, const _Alloc& __a)
178  : c(std::move(__q.c), __a) { }
179 #endif
180 
181  /**
182  * Returns true if the %queue is empty.
183  */
184  bool
185  empty() const
186  { return c.empty(); }
187 
188  /** Returns the number of elements in the %queue. */
189  size_type
190  size() const
191  { return c.size(); }
192 
193  /**
194  * Returns a read/write reference to the data at the first
195  * element of the %queue.
196  */
197  reference
199  {
200  __glibcxx_requires_nonempty();
201  return c.front();
202  }
203 
204  /**
205  * Returns a read-only (constant) reference to the data at the first
206  * element of the %queue.
207  */
208  const_reference
209  front() const
210  {
211  __glibcxx_requires_nonempty();
212  return c.front();
213  }
214 
215  /**
216  * Returns a read/write reference to the data at the last
217  * element of the %queue.
218  */
219  reference
221  {
222  __glibcxx_requires_nonempty();
223  return c.back();
224  }
225 
226  /**
227  * Returns a read-only (constant) reference to the data at the last
228  * element of the %queue.
229  */
230  const_reference
231  back() const
232  {
233  __glibcxx_requires_nonempty();
234  return c.back();
235  }
236 
237  /**
238  * @brief Add data to the end of the %queue.
239  * @param __x Data to be added.
240  *
241  * This is a typical %queue operation. The function creates an
242  * element at the end of the %queue and assigns the given data
243  * to it. The time complexity of the operation depends on the
244  * underlying sequence.
245  */
246  void
247  push(const value_type& __x)
248  { c.push_back(__x); }
249 
250 #if __cplusplus >= 201103L
251  void
252  push(value_type&& __x)
253  { c.push_back(std::move(__x)); }
254 
255 #if __cplusplus > 201402L
256  template<typename... _Args>
257  decltype(auto)
258  emplace(_Args&&... __args)
259  { return c.emplace_back(std::forward<_Args>(__args)...); }
260 #else
261  template<typename... _Args>
262  void
263  emplace(_Args&&... __args)
264  { c.emplace_back(std::forward<_Args>(__args)...); }
265 #endif
266 #endif
267 
268  /**
269  * @brief Removes first element.
270  *
271  * This is a typical %queue operation. It shrinks the %queue by one.
272  * The time complexity of the operation depends on the underlying
273  * sequence.
274  *
275  * Note that no data is returned, and if the first element's
276  * data is needed, it should be retrieved before pop() is
277  * called.
278  */
279  void
280  pop()
281  {
282  __glibcxx_requires_nonempty();
283  c.pop_front();
284  }
285 
286 #if __cplusplus >= 201103L
287  void
288  swap(queue& __q)
289 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
290  noexcept(__is_nothrow_swappable<_Sequence>::value)
291 #else
292  noexcept(__is_nothrow_swappable<_Tp>::value)
293 #endif
294  {
295  using std::swap;
296  swap(c, __q.c);
297  }
298 #endif // __cplusplus >= 201103L
299  };
300 
301  /**
302  * @brief Queue equality comparison.
303  * @param __x A %queue.
304  * @param __y A %queue of the same type as @a __x.
305  * @return True iff the size and elements of the queues are equal.
306  *
307  * This is an equivalence relation. Complexity and semantics depend on the
308  * underlying sequence type, but the expected rules are: this relation is
309  * linear in the size of the sequences, and queues are considered equivalent
310  * if their sequences compare equal.
311  */
312  template<typename _Tp, typename _Seq>
313  inline bool
314  operator==(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
315  { return __x.c == __y.c; }
316 
317  /**
318  * @brief Queue ordering relation.
319  * @param __x A %queue.
320  * @param __y A %queue of the same type as @a x.
321  * @return True iff @a __x is lexicographically less than @a __y.
322  *
323  * This is an total ordering relation. Complexity and semantics
324  * depend on the underlying sequence type, but the expected rules
325  * are: this relation is linear in the size of the sequences, the
326  * elements must be comparable with @c <, and
327  * std::lexicographical_compare() is usually used to make the
328  * determination.
329  */
330  template<typename _Tp, typename _Seq>
331  inline bool
332  operator<(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
333  { return __x.c < __y.c; }
334 
335  /// Based on operator==
336  template<typename _Tp, typename _Seq>
337  inline bool
338  operator!=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
339  { return !(__x == __y); }
340 
341  /// Based on operator<
342  template<typename _Tp, typename _Seq>
343  inline bool
344  operator>(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
345  { return __y < __x; }
346 
347  /// Based on operator<
348  template<typename _Tp, typename _Seq>
349  inline bool
350  operator<=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
351  { return !(__y < __x); }
352 
353  /// Based on operator<
354  template<typename _Tp, typename _Seq>
355  inline bool
356  operator>=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
357  { return !(__x < __y); }
358 
359 #if __cplusplus >= 201103L
360  template<typename _Tp, typename _Seq>
361  inline
362 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
363  // Constrained free swap overload, see p0185r1
364  typename enable_if<__is_swappable<_Seq>::value>::type
365 #else
366  void
367 #endif
368  swap(queue<_Tp, _Seq>& __x, queue<_Tp, _Seq>& __y)
369  noexcept(noexcept(__x.swap(__y)))
370  { __x.swap(__y); }
371 
372  template<typename _Tp, typename _Seq, typename _Alloc>
373  struct uses_allocator<queue<_Tp, _Seq>, _Alloc>
374  : public uses_allocator<_Seq, _Alloc>::type { };
375 #endif // __cplusplus >= 201103L
376 
377  /**
378  * @brief A standard container automatically sorting its contents.
379  *
380  * @ingroup sequences
381  *
382  * @tparam _Tp Type of element.
383  * @tparam _Sequence Type of underlying sequence, defaults to vector<_Tp>.
384  * @tparam _Compare Comparison function object type, defaults to
385  * less<_Sequence::value_type>.
386  *
387  * This is not a true container, but an @e adaptor. It holds
388  * another container, and provides a wrapper interface to that
389  * container. The wrapper is what enforces priority-based sorting
390  * and %queue behavior. Very few of the standard container/sequence
391  * interface requirements are met (e.g., iterators).
392  *
393  * The second template parameter defines the type of the underlying
394  * sequence/container. It defaults to std::vector, but it can be
395  * any type that supports @c front(), @c push_back, @c pop_back,
396  * and random-access iterators, such as std::deque or an
397  * appropriate user-defined type.
398  *
399  * The third template parameter supplies the means of making
400  * priority comparisons. It defaults to @c less<value_type> but
401  * can be anything defining a strict weak ordering.
402  *
403  * Members not found in @a normal containers are @c container_type,
404  * which is a typedef for the second Sequence parameter, and @c
405  * push, @c pop, and @c top, which are standard %queue operations.
406  *
407  * @note No equality/comparison operators are provided for
408  * %priority_queue.
409  *
410  * @note Sorting of the elements takes place as they are added to,
411  * and removed from, the %priority_queue using the
412  * %priority_queue's member functions. If you access the elements
413  * by other means, and change their data such that the sorting
414  * order would be different, the %priority_queue will not re-sort
415  * the elements for you. (How could it know to do so?)
416  */
417  template<typename _Tp, typename _Sequence = vector<_Tp>,
418  typename _Compare = less<typename _Sequence::value_type> >
420  {
421  // concept requirements
422  typedef typename _Sequence::value_type _Sequence_value_type;
423  __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
424  __glibcxx_class_requires(_Sequence, _SequenceConcept)
425  __glibcxx_class_requires(_Sequence, _RandomAccessContainerConcept)
426  __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
427  __glibcxx_class_requires4(_Compare, bool, _Tp, _Tp,
428  _BinaryFunctionConcept)
429 
430 #if __cplusplus >= 201103L
431  template<typename _Alloc>
432  using _Uses = typename
433  enable_if<uses_allocator<_Sequence, _Alloc>::value>::type;
434 #endif
435 
436  public:
437  typedef typename _Sequence::value_type value_type;
438  typedef typename _Sequence::reference reference;
439  typedef typename _Sequence::const_reference const_reference;
440  typedef typename _Sequence::size_type size_type;
441  typedef _Sequence container_type;
442  // _GLIBCXX_RESOLVE_LIB_DEFECTS
443  // DR 2684. priority_queue lacking comparator typedef
444  typedef _Compare value_compare;
445 
446  protected:
447  // See queue::c for notes on these names.
448  _Sequence c;
449  _Compare comp;
450 
451  public:
452  /**
453  * @brief Default constructor creates no elements.
454  */
455 #if __cplusplus < 201103L
456  explicit
457  priority_queue(const _Compare& __x = _Compare(),
458  const _Sequence& __s = _Sequence())
459  : c(__s), comp(__x)
460  { std::make_heap(c.begin(), c.end(), comp); }
461 #else
462  template<typename _Seq = _Sequence, typename _Requires = typename
463  enable_if<__and_<is_default_constructible<_Compare>,
464  is_default_constructible<_Seq>>::value>::type>
466  : c(), comp() { }
467 
468  explicit
469  priority_queue(const _Compare& __x, const _Sequence& __s)
470  : c(__s), comp(__x)
471  { std::make_heap(c.begin(), c.end(), comp); }
472 
473  explicit
474  priority_queue(const _Compare& __x, _Sequence&& __s = _Sequence())
475  : c(std::move(__s)), comp(__x)
476  { std::make_heap(c.begin(), c.end(), comp); }
477 
478  template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
479  explicit
480  priority_queue(const _Alloc& __a)
481  : c(__a), comp() { }
482 
483  template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
484  priority_queue(const _Compare& __x, const _Alloc& __a)
485  : c(__a), comp(__x) { }
486 
487  template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
488  priority_queue(const _Compare& __x, const _Sequence& __c,
489  const _Alloc& __a)
490  : c(__c, __a), comp(__x) { }
491 
492  template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
493  priority_queue(const _Compare& __x, _Sequence&& __c, const _Alloc& __a)
494  : c(std::move(__c), __a), comp(__x) { }
495 
496  template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
497  priority_queue(const priority_queue& __q, const _Alloc& __a)
498  : c(__q.c, __a), comp(__q.comp) { }
499 
500  template<typename _Alloc, typename _Requires = _Uses<_Alloc>>
501  priority_queue(priority_queue&& __q, const _Alloc& __a)
502  : c(std::move(__q.c), __a), comp(std::move(__q.comp)) { }
503 #endif
504 
505  /**
506  * @brief Builds a %queue from a range.
507  * @param __first An input iterator.
508  * @param __last An input iterator.
509  * @param __x A comparison functor describing a strict weak ordering.
510  * @param __s An initial sequence with which to start.
511  *
512  * Begins by copying @a __s, inserting a copy of the elements
513  * from @a [first,last) into the copy of @a __s, then ordering
514  * the copy according to @a __x.
515  *
516  * For more information on function objects, see the
517  * documentation on @link functors functor base
518  * classes@endlink.
519  */
520 #if __cplusplus < 201103L
521  template<typename _InputIterator>
522  priority_queue(_InputIterator __first, _InputIterator __last,
523  const _Compare& __x = _Compare(),
524  const _Sequence& __s = _Sequence())
525  : c(__s), comp(__x)
526  {
527  __glibcxx_requires_valid_range(__first, __last);
528  c.insert(c.end(), __first, __last);
529  std::make_heap(c.begin(), c.end(), comp);
530  }
531 #else
532  template<typename _InputIterator>
533  priority_queue(_InputIterator __first, _InputIterator __last,
534  const _Compare& __x,
535  const _Sequence& __s)
536  : c(__s), comp(__x)
537  {
538  __glibcxx_requires_valid_range(__first, __last);
539  c.insert(c.end(), __first, __last);
540  std::make_heap(c.begin(), c.end(), comp);
541  }
542 
543  template<typename _InputIterator>
544  priority_queue(_InputIterator __first, _InputIterator __last,
545  const _Compare& __x = _Compare(),
546  _Sequence&& __s = _Sequence())
547  : c(std::move(__s)), comp(__x)
548  {
549  __glibcxx_requires_valid_range(__first, __last);
550  c.insert(c.end(), __first, __last);
551  std::make_heap(c.begin(), c.end(), comp);
552  }
553 #endif
554 
555  /**
556  * Returns true if the %queue is empty.
557  */
558  bool
559  empty() const
560  { return c.empty(); }
561 
562  /** Returns the number of elements in the %queue. */
563  size_type
564  size() const
565  { return c.size(); }
566 
567  /**
568  * Returns a read-only (constant) reference to the data at the first
569  * element of the %queue.
570  */
571  const_reference
572  top() const
573  {
574  __glibcxx_requires_nonempty();
575  return c.front();
576  }
577 
578  /**
579  * @brief Add data to the %queue.
580  * @param __x Data to be added.
581  *
582  * This is a typical %queue operation.
583  * The time complexity of the operation depends on the underlying
584  * sequence.
585  */
586  void
587  push(const value_type& __x)
588  {
589  c.push_back(__x);
590  std::push_heap(c.begin(), c.end(), comp);
591  }
592 
593 #if __cplusplus >= 201103L
594  void
595  push(value_type&& __x)
596  {
597  c.push_back(std::move(__x));
598  std::push_heap(c.begin(), c.end(), comp);
599  }
600 
601  template<typename... _Args>
602  void
603  emplace(_Args&&... __args)
604  {
605  c.emplace_back(std::forward<_Args>(__args)...);
606  std::push_heap(c.begin(), c.end(), comp);
607  }
608 #endif
609 
610  /**
611  * @brief Removes first element.
612  *
613  * This is a typical %queue operation. It shrinks the %queue
614  * by one. The time complexity of the operation depends on the
615  * underlying sequence.
616  *
617  * Note that no data is returned, and if the first element's
618  * data is needed, it should be retrieved before pop() is
619  * called.
620  */
621  void
622  pop()
623  {
624  __glibcxx_requires_nonempty();
625  std::pop_heap(c.begin(), c.end(), comp);
626  c.pop_back();
627  }
628 
629 #if __cplusplus >= 201103L
630  void
631  swap(priority_queue& __pq)
632  noexcept(__and_<
633 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
634  __is_nothrow_swappable<_Sequence>,
635 #else
636  __is_nothrow_swappable<_Tp>,
637 #endif
638  __is_nothrow_swappable<_Compare>
639  >::value)
640  {
641  using std::swap;
642  swap(c, __pq.c);
643  swap(comp, __pq.comp);
644  }
645 #endif // __cplusplus >= 201103L
646  };
647 
648  // No equality/comparison operators are provided for priority_queue.
649 
650 #if __cplusplus >= 201103L
651  template<typename _Tp, typename _Sequence, typename _Compare>
652  inline
653 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
654  // Constrained free swap overload, see p0185r1
655  typename enable_if<__and_<__is_swappable<_Sequence>,
656  __is_swappable<_Compare>>::value>::type
657 #else
658  void
659 #endif
662  noexcept(noexcept(__x.swap(__y)))
663  { __x.swap(__y); }
664 
665  template<typename _Tp, typename _Sequence, typename _Compare,
666  typename _Alloc>
667  struct uses_allocator<priority_queue<_Tp, _Sequence, _Compare>, _Alloc>
668  : public uses_allocator<_Sequence, _Alloc>::type { };
669 #endif // __cplusplus >= 201103L
670 
671 _GLIBCXX_END_NAMESPACE_VERSION
672 } // namespace
673 
674 #endif /* _STL_QUEUE_H */
void pop()
Removes first element.
Definition: stl_queue.h:622
void push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
Push an element onto a heap using comparison functor.
Definition: stl_heap.h:188
size_type size() const
Definition: stl_queue.h:564
reference back()
Definition: stl_queue.h:220
size_type size() const
Definition: stl_queue.h:190
ISO C++ entities toplevel namespace is std.
priority_queue()
Default constructor creates no elements.
Definition: stl_queue.h:465
reference front()
Definition: stl_queue.h:198
queue()
Default constructor creates no elements.
Definition: stl_queue.h:148
void make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
Construct a heap over a range using comparison functor.
Definition: stl_heap.h:385
_Sequence c
c is the underlying container.
Definition: stl_queue.h:135
priority_queue(_InputIterator __first, _InputIterator __last, const _Compare &__x, const _Sequence &__s)
Builds a queue from a range.
Definition: stl_queue.h:533
A standard container giving FIFO behavior.
Definition: stl_queue.h:96
bool empty() const
Definition: stl_queue.h:185
bool empty() const
Definition: stl_queue.h:559
const_reference front() const
Definition: stl_queue.h:209
const_reference back() const
Definition: stl_queue.h:231
Declare uses_allocator so it can be specialized in <queue> etc.
Definition: memoryfwd.h:71
void push(const value_type &__x)
Add data to the queue.
Definition: stl_queue.h:587
A standard container automatically sorting its contents.
Definition: stl_queue.h:419
void pop()
Removes first element.
Definition: stl_queue.h:280
void push(const value_type &__x)
Add data to the end of the queue.
Definition: stl_queue.h:247
const_reference top() const
Definition: stl_queue.h:572
void pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
Pop an element off a heap using comparison functor.
Definition: stl_heap.h:303