59 #define _STL_QUEUE_H 1
64 namespace std _GLIBCXX_VISIBILITY(default)
66 _GLIBCXX_BEGIN_NAMESPACE_VERSION
91 template<
typename _Tp,
typename _Sequence = deque<_Tp> >
95 typedef typename _Sequence::value_type _Sequence_value_type;
96 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
97 __glibcxx_class_requires(_Sequence, _FrontInsertionSequenceConcept)
98 __glibcxx_class_requires(_Sequence, _BackInsertionSequenceConcept)
99 __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
101 template<
typename _Tp1,
typename _Seq1>
105 template<
typename _Tp1,
typename _Seq1>
110 typedef typename _Sequence::value_type value_type;
111 typedef typename _Sequence::reference reference;
112 typedef typename _Sequence::const_reference const_reference;
113 typedef typename _Sequence::size_type size_type;
114 typedef _Sequence container_type;
131 #ifndef __GXX_EXPERIMENTAL_CXX0X__
133 queue(
const _Sequence& __c = _Sequence())
141 queue(_Sequence&& __c = _Sequence())
142 :
c(std::move(__c)) { }
150 {
return c.empty(); }
164 __glibcxx_requires_nonempty();
175 __glibcxx_requires_nonempty();
186 __glibcxx_requires_nonempty();
197 __glibcxx_requires_nonempty();
212 {
c.push_back(__x); }
214 #ifdef __GXX_EXPERIMENTAL_CXX0X__
216 push(value_type&& __x)
217 {
c.push_back(std::move(__x)); }
219 template<
typename... _Args>
221 emplace(_Args&&... __args)
222 {
c.emplace_back(std::forward<_Args>(__args)...); }
239 __glibcxx_requires_nonempty();
243 #ifdef __GXX_EXPERIMENTAL_CXX0X__
264 template<
typename _Tp,
typename _Seq>
267 {
return __x.
c == __y.
c; }
282 template<
typename _Tp,
typename _Seq>
285 {
return __x.
c < __y.c; }
288 template<
typename _Tp,
typename _Seq>
291 {
return !(__x == __y); }
294 template<
typename _Tp,
typename _Seq>
297 {
return __y < __x; }
300 template<
typename _Tp,
typename _Seq>
303 {
return !(__y < __x); }
306 template<
typename _Tp,
typename _Seq>
309 {
return !(__x < __y); }
311 #ifdef __GXX_EXPERIMENTAL_CXX0X__
312 template<
typename _Tp,
typename _Seq>
314 swap(queue<_Tp, _Seq>& __x, queue<_Tp, _Seq>& __y)
317 template<
typename _Tp,
typename _Seq,
typename _Alloc>
318 struct uses_allocator<queue<_Tp, _Seq>, _Alloc>
319 :
public uses_allocator<_Seq, _Alloc>::type { };
357 template<
typename _Tp,
typename _Sequence = vector<_Tp>,
358 typename _Compare = less<
typename _Sequence::value_type> >
362 typedef typename _Sequence::value_type _Sequence_value_type;
363 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
364 __glibcxx_class_requires(_Sequence, _SequenceConcept)
365 __glibcxx_class_requires(_Sequence, _RandomAccessContainerConcept)
366 __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
367 __glibcxx_class_requires4(_Compare,
bool, _Tp, _Tp,
368 _BinaryFunctionConcept)
371 typedef typename _Sequence::value_type value_type;
372 typedef typename _Sequence::reference reference;
373 typedef typename _Sequence::const_reference const_reference;
374 typedef typename _Sequence::size_type size_type;
375 typedef _Sequence container_type;
386 #ifndef __GXX_EXPERIMENTAL_CXX0X__
389 const _Sequence& __s = _Sequence())
395 const _Sequence& __s)
401 _Sequence&& __s = _Sequence())
402 : c(std::move(__s)), comp(__x)
421 #ifndef __GXX_EXPERIMENTAL_CXX0X__
422 template<
typename _InputIterator>
424 const _Compare& __x = _Compare(),
425 const _Sequence& __s = _Sequence())
428 __glibcxx_requires_valid_range(__first, __last);
429 c.insert(c.end(), __first, __last);
430 std::make_heap(c.begin(), c.end(), comp);
433 template<
typename _InputIterator>
436 const _Sequence& __s)
439 __glibcxx_requires_valid_range(__first, __last);
440 c.insert(c.end(), __first, __last);
444 template<
typename _InputIterator>
446 const _Compare& __x = _Compare(),
447 _Sequence&& __s = _Sequence())
448 : c(std::move(__s)), comp(__x)
450 __glibcxx_requires_valid_range(__first, __last);
451 c.insert(c.end(), __first, __last);
461 {
return c.empty(); }
475 __glibcxx_requires_nonempty();
494 #ifdef __GXX_EXPERIMENTAL_CXX0X__
496 push(value_type&& __x)
498 c.push_back(std::move(__x));
502 template<
typename... _Args>
504 emplace(_Args&&... __args)
506 c.emplace_back(std::forward<_Args>(__args)...);
507 std::push_heap(c.begin(), c.end(), comp);
525 __glibcxx_requires_nonempty();
530 #ifdef __GXX_EXPERIMENTAL_CXX0X__
536 swap(comp, __pq.comp);
543 #ifdef __GXX_EXPERIMENTAL_CXX0X__
544 template<
typename _Tp,
typename _Sequence,
typename _Compare>
546 swap(priority_queue<_Tp, _Sequence, _Compare>& __x,
547 priority_queue<_Tp, _Sequence, _Compare>& __y)
550 template<
typename _Tp,
typename _Sequence,
typename _Compare,
552 struct uses_allocator<priority_queue<_Tp, _Sequence, _Compare>, _Alloc>
553 :
public uses_allocator<_Sequence, _Alloc>::type { };
556 _GLIBCXX_END_NAMESPACE_VERSION
void pop()
Removes first element.
const_reference back() const
A standard container giving FIFO behavior.
void pop()
Removes first element.
void make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
Construct a heap over a range using comparison functor.
void push(const value_type &__x)
Add data to the end of the queue.
void push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
Push an element onto a heap using comparison functor.
queue(const _Sequence &__c)
Default constructor creates no elements.
void pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
Pop an element off a heap using comparison functor.
const_reference top() const
A standard container automatically sorting its contents.
void push(const value_type &__x)
Add data to the queue.
priority_queue(_InputIterator __first, _InputIterator __last, const _Compare &__x, const _Sequence &__s)
Builds a queue from a range.
priority_queue(const _Compare &__x, const _Sequence &__s)
Default constructor creates no elements.
const_reference front() const