57 #define _STL_QUEUE_H 1
61 #if __cplusplus >= 201103L
62 # include <bits/uses_allocator.h>
65 namespace std _GLIBCXX_VISIBILITY(default)
67 _GLIBCXX_BEGIN_NAMESPACE_VERSION
95 template<
typename _Tp,
typename _Sequence = deque<_Tp> >
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)
105 template<
typename _Tp1,
typename _Seq1>
109 template<
typename _Tp1,
typename _Seq1>
114 typedef typename _Sequence::value_type value_type;
115 typedef typename _Sequence::reference reference;
116 typedef typename _Sequence::const_reference const_reference;
117 typedef typename _Sequence::size_type size_type;
118 typedef _Sequence container_type;
135 #if __cplusplus < 201103L
137 queue(
const _Sequence& __c = _Sequence())
145 queue(_Sequence&& __c = _Sequence())
154 {
return c.empty(); }
168 __glibcxx_requires_nonempty();
179 __glibcxx_requires_nonempty();
190 __glibcxx_requires_nonempty();
201 __glibcxx_requires_nonempty();
216 { c.push_back(__x); }
218 #if __cplusplus >= 201103L
220 push(value_type&& __x)
223 template<
typename... _Args>
225 emplace(_Args&&... __args)
226 { c.emplace_back(std::forward<_Args>(__args)...); }
243 __glibcxx_requires_nonempty();
247 #if __cplusplus >= 201103L
250 noexcept(noexcept(swap(c, __q.c)))
269 template<
typename _Tp,
typename _Seq>
272 {
return __x.
c == __y.
c; }
287 template<
typename _Tp,
typename _Seq>
290 {
return __x.
c < __y.c; }
293 template<
typename _Tp,
typename _Seq>
296 {
return !(__x == __y); }
299 template<
typename _Tp,
typename _Seq>
302 {
return __y < __x; }
305 template<
typename _Tp,
typename _Seq>
308 {
return !(__y < __x); }
311 template<
typename _Tp,
typename _Seq>
314 {
return !(__x < __y); }
316 #if __cplusplus >= 201103L
317 template<
typename _Tp,
typename _Seq>
319 swap(queue<_Tp, _Seq>& __x, queue<_Tp, _Seq>& __y)
320 noexcept(noexcept(__x.swap(__y)))
323 template<
typename _Tp,
typename _Seq,
typename _Alloc>
324 struct uses_allocator<queue<_Tp, _Seq>, _Alloc>
325 :
public uses_allocator<_Seq, _Alloc>::type { };
368 template<
typename _Tp,
typename _Sequence = vector<_Tp>,
369 typename _Compare = less<
typename _Sequence::value_type> >
373 typedef typename _Sequence::value_type _Sequence_value_type;
374 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
375 __glibcxx_class_requires(_Sequence, _SequenceConcept)
376 __glibcxx_class_requires(_Sequence, _RandomAccessContainerConcept)
377 __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
378 __glibcxx_class_requires4(_Compare,
bool, _Tp, _Tp,
379 _BinaryFunctionConcept)
382 typedef typename _Sequence::value_type value_type;
383 typedef typename _Sequence::reference reference;
384 typedef typename _Sequence::const_reference const_reference;
385 typedef typename _Sequence::size_type size_type;
386 typedef _Sequence container_type;
397 #if __cplusplus < 201103L
400 const _Sequence& __s = _Sequence())
406 const _Sequence& __s)
412 _Sequence&& __s = _Sequence())
432 #if __cplusplus < 201103L
433 template<
typename _InputIterator>
435 const _Compare& __x = _Compare(),
436 const _Sequence& __s = _Sequence())
439 __glibcxx_requires_valid_range(__first, __last);
440 c.insert(c.end(), __first, __last);
441 std::make_heap(c.begin(), c.end(), comp);
444 template<
typename _InputIterator>
447 const _Sequence& __s)
450 __glibcxx_requires_valid_range(__first, __last);
451 c.insert(c.end(), __first, __last);
455 template<
typename _InputIterator>
457 const _Compare& __x = _Compare(),
458 _Sequence&& __s = _Sequence())
461 __glibcxx_requires_valid_range(__first, __last);
462 c.insert(c.end(), __first, __last);
472 {
return c.empty(); }
486 __glibcxx_requires_nonempty();
505 #if __cplusplus >= 201103L
507 push(value_type&& __x)
513 template<
typename... _Args>
515 emplace(_Args&&... __args)
517 c.emplace_back(std::forward<_Args>(__args)...);
518 std::push_heap(c.begin(), c.end(), comp);
536 __glibcxx_requires_nonempty();
541 #if __cplusplus >= 201103L
544 noexcept(noexcept(swap(c, __pq.c)) && noexcept(swap(comp, __pq.comp)))
548 swap(comp, __pq.comp);
555 #if __cplusplus >= 201103L
556 template<
typename _Tp,
typename _Sequence,
typename _Compare>
558 swap(priority_queue<_Tp, _Sequence, _Compare>& __x,
559 priority_queue<_Tp, _Sequence, _Compare>& __y)
560 noexcept(noexcept(__x.swap(__y)))
563 template<
typename _Tp,
typename _Sequence,
typename _Compare,
565 struct uses_allocator<priority_queue<_Tp, _Sequence, _Compare>, _Alloc>
566 :
public uses_allocator<_Sequence, _Alloc>::type { };
569 _GLIBCXX_END_NAMESPACE_VERSION
priority_queue(const _Compare &__x, const _Sequence &__s)
Default constructor creates no elements.
void push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
Push an element onto a heap using comparison functor.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
A standard container giving FIFO behavior.
priority_queue(_InputIterator __first, _InputIterator __last, const _Compare &__x, const _Sequence &__s)
Builds a queue from a range.
void push(const value_type &__x)
Add data to the queue.
const_reference top() const
const_reference front() const
void pop()
Removes first element.
const_reference back() const
void push(const value_type &__x)
Add data to the end of the queue.
void pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
Pop an element off a heap using comparison functor.
ISO C++ entities toplevel namespace is std.
A standard container automatically sorting its contents.
void pop()
Removes first element.
bool operator>=(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string doesn't precede string.
bool operator>(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string follows string.
void swap(_Tp &, _Tp &) noexcept(__and_< is_nothrow_move_constructible< _Tp >, is_nothrow_move_assignable< _Tp >>::value)
Swaps two values.
queue(const _Sequence &__c)
Default constructor creates no elements.
void make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
Construct a heap over a range using comparison functor.