57 #define _STL_QUEUE_H 1
62 namespace std _GLIBCXX_VISIBILITY(default)
64 _GLIBCXX_BEGIN_NAMESPACE_VERSION
92 template<
typename _Tp,
typename _Sequence = deque<_Tp> >
96 typedef typename _Sequence::value_type _Sequence_value_type;
97 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
98 __glibcxx_class_requires(_Sequence, _FrontInsertionSequenceConcept)
99 __glibcxx_class_requires(_Sequence, _BackInsertionSequenceConcept)
100 __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
102 template<
typename _Tp1,
typename _Seq1>
106 template<
typename _Tp1,
typename _Seq1>
111 typedef typename _Sequence::value_type value_type;
112 typedef typename _Sequence::reference reference;
113 typedef typename _Sequence::const_reference const_reference;
114 typedef typename _Sequence::size_type size_type;
115 typedef _Sequence container_type;
132 #if __cplusplus < 201103L
134 queue(
const _Sequence& __c = _Sequence())
142 queue(_Sequence&& __c = _Sequence())
151 {
return c.empty(); }
165 __glibcxx_requires_nonempty();
176 __glibcxx_requires_nonempty();
187 __glibcxx_requires_nonempty();
198 __glibcxx_requires_nonempty();
213 { c.push_back(__x); }
215 #if __cplusplus >= 201103L
217 push(value_type&& __x)
220 template<
typename... _Args>
222 emplace(_Args&&... __args)
223 { c.emplace_back(std::forward<_Args>(__args)...); }
240 __glibcxx_requires_nonempty();
244 #if __cplusplus >= 201103L
247 noexcept(noexcept(swap(c, __q.c)))
266 template<
typename _Tp,
typename _Seq>
269 {
return __x.
c == __y.
c; }
284 template<
typename _Tp,
typename _Seq>
287 {
return __x.
c < __y.c; }
290 template<
typename _Tp,
typename _Seq>
293 {
return !(__x == __y); }
296 template<
typename _Tp,
typename _Seq>
299 {
return __y < __x; }
302 template<
typename _Tp,
typename _Seq>
305 {
return !(__y < __x); }
308 template<
typename _Tp,
typename _Seq>
311 {
return !(__x < __y); }
313 #if __cplusplus >= 201103L
314 template<
typename _Tp,
typename _Seq>
316 swap(queue<_Tp, _Seq>& __x, queue<_Tp, _Seq>& __y)
317 noexcept(noexcept(__x.swap(__y)))
320 template<
typename _Tp,
typename _Seq,
typename _Alloc>
321 struct uses_allocator<queue<_Tp, _Seq>, _Alloc>
322 :
public uses_allocator<_Seq, _Alloc>::type { };
365 template<
typename _Tp,
typename _Sequence = vector<_Tp>,
366 typename _Compare = less<
typename _Sequence::value_type> >
370 typedef typename _Sequence::value_type _Sequence_value_type;
371 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
372 __glibcxx_class_requires(_Sequence, _SequenceConcept)
373 __glibcxx_class_requires(_Sequence, _RandomAccessContainerConcept)
374 __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
375 __glibcxx_class_requires4(_Compare,
bool, _Tp, _Tp,
376 _BinaryFunctionConcept)
379 typedef typename _Sequence::value_type value_type;
380 typedef typename _Sequence::reference reference;
381 typedef typename _Sequence::const_reference const_reference;
382 typedef typename _Sequence::size_type size_type;
383 typedef _Sequence container_type;
394 #if __cplusplus < 201103L
397 const _Sequence& __s = _Sequence())
403 const _Sequence& __s)
409 _Sequence&& __s = _Sequence())
429 #if __cplusplus < 201103L
430 template<
typename _InputIterator>
432 const _Compare& __x = _Compare(),
433 const _Sequence& __s = _Sequence())
436 __glibcxx_requires_valid_range(__first, __last);
437 c.insert(c.end(), __first, __last);
438 std::make_heap(c.begin(), c.end(), comp);
441 template<
typename _InputIterator>
444 const _Sequence& __s)
447 __glibcxx_requires_valid_range(__first, __last);
448 c.insert(c.end(), __first, __last);
452 template<
typename _InputIterator>
454 const _Compare& __x = _Compare(),
455 _Sequence&& __s = _Sequence())
458 __glibcxx_requires_valid_range(__first, __last);
459 c.insert(c.end(), __first, __last);
469 {
return c.empty(); }
483 __glibcxx_requires_nonempty();
502 #if __cplusplus >= 201103L
504 push(value_type&& __x)
510 template<
typename... _Args>
512 emplace(_Args&&... __args)
514 c.emplace_back(std::forward<_Args>(__args)...);
515 std::push_heap(c.begin(), c.end(), comp);
533 __glibcxx_requires_nonempty();
538 #if __cplusplus >= 201103L
541 noexcept(noexcept(swap(c, __pq.c)) && noexcept(swap(comp, __pq.comp)))
545 swap(comp, __pq.comp);
552 #if __cplusplus >= 201103L
553 template<
typename _Tp,
typename _Sequence,
typename _Compare>
555 swap(priority_queue<_Tp, _Sequence, _Compare>& __x,
556 priority_queue<_Tp, _Sequence, _Compare>& __y)
557 noexcept(noexcept(__x.swap(__y)))
560 template<
typename _Tp,
typename _Sequence,
typename _Compare,
562 struct uses_allocator<priority_queue<_Tp, _Sequence, _Compare>, _Alloc>
563 :
public uses_allocator<_Sequence, _Alloc>::type { };
566 _GLIBCXX_END_NAMESPACE_VERSION
const_reference back() const
void pop()
Removes first element.
void push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
Push an element onto a heap using comparison functor.
void make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
Construct a heap over a range using comparison functor.
priority_queue(const _Compare &__x, const _Sequence &__s)
Default constructor creates no elements.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
bool operator>=(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string doesn't precede string.
void push(const value_type &__x)
Add data to the queue.
ISO C++ entities toplevel namespace is std.
const_reference top() const
const_reference front() const
A standard container giving FIFO behavior.
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.
queue(const _Sequence &__c)
Default constructor creates no elements.
void swap(_Tp &, _Tp &) noexcept(__and_< is_nothrow_move_constructible< _Tp >, is_nothrow_move_assignable< _Tp >>::value)
Swaps two values.
void pop()
Removes first element.
A standard container automatically sorting its contents.
priority_queue(_InputIterator __first, _InputIterator __last, const _Compare &__x, const _Sequence &__s)
Builds a queue from a range.
bool operator>(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string follows string.