102#ifdef _GLIBCXX_CONCEPT_CHECKS
104 typedef typename _Sequence::value_type _Sequence_value_type;
105# if __cplusplus < 201103L
106 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
108 __glibcxx_class_requires(_Sequence, _FrontInsertionSequenceConcept)
109 __glibcxx_class_requires(_Sequence, _BackInsertionSequenceConcept)
110 __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
113 template<
typename _Tp1,
typename _Seq1>
117 template<
typename _Tp1,
typename _Seq1>
121#if __cpp_lib_three_way_comparison
122 template<
typename _Tp1, three_way_comparable _Seq1>
127#if __cplusplus >= 201103L
128 template<
typename _Alloc>
129 using _Uses =
typename
132#if __cplusplus >= 201703L
137 "value_type must be the same as the underlying container");
142 typedef typename _Sequence::value_type value_type;
143 typedef typename _Sequence::reference reference;
144 typedef typename _Sequence::const_reference const_reference;
145 typedef typename _Sequence::size_type size_type;
146 typedef _Sequence container_type;
163#if __cplusplus < 201103L
165 queue(
const _Sequence& __c = _Sequence())
168 template<
typename _Seq = _Sequence,
typename _Requires =
typename
174 queue(
const _Sequence& __c)
178 queue(_Sequence&& __c)
181 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
183 queue(
const _Alloc& __a)
186 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
187 queue(
const _Sequence& __c,
const _Alloc& __a)
190 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
191 queue(_Sequence&& __c,
const _Alloc& __a)
192 :
c(std::
move(__c), __a) { }
194 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
198 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
200 :
c(std::
move(__q.
c), __a) { }
203#ifdef __glibcxx_adaptor_iterator_pair_constructor
204 template<
typename _InputIterator,
205 typename = _RequireInputIter<_InputIterator>>
206 queue(_InputIterator __first, _InputIterator __last)
207 :
c(__first, __last) { }
209 template<
typename _InputIterator,
typename _Alloc,
210 typename = _RequireInputIter<_InputIterator>,
211 typename = _Uses<_Alloc>>
212 queue(_InputIterator __first, _InputIterator __last,
const _Alloc& __a)
213 :
c(__first, __last, __a) { }
216#if __glibcxx_ranges_to_container
221 template<__detail::__container_compatible_range<_Tp> _Rg>
222 queue(from_range_t, _Rg&& __rg)
223 :
c(ranges::to<_Sequence>(std::
forward<_Rg>(__rg)))
230 template<__detail::__container_compatible_range<_Tp> _Rg,
232 queue(from_range_t, _Rg&& __rg,
const _Alloc& __a)
233 :
c(ranges::to<_Sequence>(std::
forward<_Rg>(__rg), __a))
240 _GLIBCXX_NODISCARD
bool
242 {
return c.empty(); }
258 __glibcxx_requires_nonempty();
270 __glibcxx_requires_nonempty();
282 __glibcxx_requires_nonempty();
294 __glibcxx_requires_nonempty();
309 {
c.push_back(__x); }
311#if __cplusplus >= 201103L
316#if __cplusplus > 201402L
317 template<
typename... _Args>
319 emplace(_Args&&... __args)
322 template<
typename... _Args>
324 emplace(_Args&&... __args)
329#if __glibcxx_ranges_to_container
330 template<__detail::__container_compatible_range<_Tp> _Rg>
332 push_range(_Rg&& __rg)
355 __glibcxx_requires_nonempty();
359#if __cplusplus >= 201103L
362#if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
363 noexcept(__is_nothrow_swappable<_Sequence>::value)
365 noexcept(__is_nothrow_swappable<_Tp>::value)
545#ifdef _GLIBCXX_CONCEPT_CHECKS
547 typedef typename _Sequence::value_type _Sequence_value_type;
548# if __cplusplus < 201103L
549 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
551 __glibcxx_class_requires(_Sequence, _SequenceConcept)
552 __glibcxx_class_requires(_Sequence, _RandomAccessContainerConcept)
553 __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
554 __glibcxx_class_requires4(_Compare,
bool, _Tp, _Tp,
555 _BinaryFunctionConcept)
558#if __cplusplus >= 201103L
559 template<
typename _Alloc>
560 using _Uses =
typename
563#if __cplusplus >= 201703L
568 "value_type must be the same as the underlying container");
573 typedef typename _Sequence::value_type value_type;
574 typedef typename _Sequence::reference reference;
575 typedef typename _Sequence::const_reference const_reference;
576 typedef typename _Sequence::size_type size_type;
577 typedef _Sequence container_type;
580 typedef _Compare value_compare;
591#if __cplusplus < 201103L
594 const _Sequence& __s = _Sequence())
596 { std::make_heap(c.begin(), c.end(), comp); }
598 template<
typename _Seq = _Sequence,
typename _Requires =
typename
607 { std::make_heap(c.begin(), c.end(), comp); }
610 priority_queue(
const _Compare& __x, _Sequence&& __s = _Sequence())
612 { std::make_heap(c.begin(), c.end(), comp); }
618 noexcept(__and_<is_nothrow_move_constructible<_Sequence>,
619 is_nothrow_move_constructible<_Compare>>::value)
620 : c(std::
move(__q.c)), comp(std::
move(__q.comp))
625 noexcept(__and_<is_nothrow_move_assignable<_Sequence>,
626 is_nothrow_move_assignable<_Compare>>::value)
634 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
639 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
641 : c(__a), comp(__x) { }
645 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
648 : c(__c, __a), comp(__x)
649 { std::make_heap(c.begin(), c.end(), comp); }
651 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
652 priority_queue(
const _Compare& __x, _Sequence&& __c,
const _Alloc& __a)
653 : c(std::
move(__c), __a), comp(__x)
654 { std::make_heap(c.begin(), c.end(), comp); }
656 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
658 : c(__q.c, __a), comp(__q.comp) { }
660 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
662 : c(std::
move(__q.c), __a), comp(std::
move(__q.comp))
680#if __cplusplus < 201103L
681 template<
typename _InputIterator>
683 const _Compare& __x = _Compare(),
684 const _Sequence& __s = _Sequence())
687 __glibcxx_requires_valid_range(__first, __last);
688 c.insert(c.end(), __first, __last);
689 std::make_heap(c.begin(), c.end(), comp);
694 template<
typename _InputIterator,
695 typename = std::_RequireInputIter<_InputIterator>>
697 const _Compare& __x = _Compare())
698 : c(__first, __last), comp(__x)
699 { std::make_heap(c.begin(), c.end(), comp); }
703 template<
typename _InputIterator,
704 typename = std::_RequireInputIter<_InputIterator>>
706 const _Compare& __x,
const _Sequence& __s)
709 __glibcxx_requires_valid_range(__first, __last);
710 c.insert(c.end(), __first, __last);
711 std::make_heap(c.begin(), c.end(), comp);
714 template<
typename _InputIterator,
715 typename = std::_RequireInputIter<_InputIterator>>
717 const _Compare& __x, _Sequence&& __s)
720 __glibcxx_requires_valid_range(__first, __last);
721 c.insert(c.end(), __first, __last);
722 std::make_heap(c.begin(), c.end(), comp);
727 template<
typename _InputIterator,
typename _Alloc,
728 typename = std::_RequireInputIter<_InputIterator>,
729 typename _Requires = _Uses<_Alloc>>
731 const _Alloc& __alloc)
732 : c(__first, __last, __alloc), comp()
733 { std::make_heap(c.begin(), c.end(), comp); }
735 template<
typename _InputIterator,
typename _Alloc,
736 typename = std::_RequireInputIter<_InputIterator>,
737 typename _Requires = _Uses<_Alloc>>
739 const _Compare& __x,
const _Alloc& __alloc)
740 : c(__first, __last, __alloc), comp(__x)
741 { std::make_heap(c.begin(), c.end(), comp); }
743 template<
typename _InputIterator,
typename _Alloc,
744 typename = std::_RequireInputIter<_InputIterator>,
745 typename _Requires = _Uses<_Alloc>>
747 const _Compare& __x,
const _Sequence& __s,
748 const _Alloc& __alloc)
749 : c(__s, __alloc), comp(__x)
751 __glibcxx_requires_valid_range(__first, __last);
752 c.insert(c.end(), __first, __last);
753 std::make_heap(c.begin(), c.end(), comp);
756 template<
typename _InputIterator,
typename _Alloc,
757 typename _Requires = _Uses<_Alloc>>
759 const _Compare& __x, _Sequence&& __s,
760 const _Alloc& __alloc)
761 : c(std::
move(__s), __alloc), comp(__x)
763 __glibcxx_requires_valid_range(__first, __last);
764 c.insert(c.end(), __first, __last);
765 std::make_heap(c.begin(), c.end(), comp);
769#if __glibcxx_ranges_to_container
776 template<__detail::__container_compatible_range<_Tp> _Rg>
778 const _Compare& __x = _Compare())
779 : c(ranges::to<_Sequence>(std::
forward<_Rg>(__rg))), comp(__x)
780 { std::make_heap(c.begin(), c.end(), comp); }
782 template<__detail::__container_compatible_range<_Tp> _Rg,
typename _Alloc>
785 : c(ranges::to<_Sequence>(std::
forward<_Rg>(__rg), __a)), comp(__x)
786 { std::make_heap(c.begin(), c.end(), comp); }
788 template<__detail::__container_compatible_range<_Tp> _Rg,
typename _Alloc>
790 : c(ranges::to<_Sequence>(std::
forward<_Rg>(__rg), __a)), comp()
791 { std::make_heap(c.begin(), c.end(), comp); }
798 _GLIBCXX_NODISCARD
bool
800 {
return c.empty(); }
816 __glibcxx_requires_nonempty();
832 std::push_heap(c.begin(), c.end(), comp);
835#if __cplusplus >= 201103L
840 std::push_heap(c.begin(), c.end(), comp);
843 template<
typename... _Args>
845 emplace(_Args&&... __args)
848 std::push_heap(c.begin(), c.end(), comp);
852#if __glibcxx_ranges_to_container
853 template<__detail::__container_compatible_range<_Tp> _Rg>
855 push_range(_Rg&& __rg)
861 std::make_heap(c.begin(), c.end(), comp);
879 __glibcxx_requires_nonempty();
880 std::pop_heap(c.begin(), c.end(), comp);
884#if __cplusplus >= 201103L
888#if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
889 __is_nothrow_swappable<_Sequence>,
891 __is_nothrow_swappable<_Tp>,
893 __is_nothrow_swappable<_Compare>
898 swap(comp, __pq.comp);