106#ifdef _GLIBCXX_CONCEPT_CHECKS
108 typedef typename _Sequence::value_type _Sequence_value_type;
109# if __cplusplus < 201103L
110 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
112 __glibcxx_class_requires(_Sequence, _FrontInsertionSequenceConcept)
113 __glibcxx_class_requires(_Sequence, _BackInsertionSequenceConcept)
114 __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
117 template<
typename _Tp1,
typename _Seq1>
121 template<
typename _Tp1,
typename _Seq1>
125#if __cpp_lib_three_way_comparison
126 template<
typename _Tp1, three_way_comparable _Seq1>
131#if __cplusplus >= 201103L
132 template<
typename _Alloc>
133 using _Uses =
typename
136#if __cplusplus >= 201703L
141 "value_type must be the same as the underlying container");
146 typedef typename _Sequence::value_type value_type;
147 typedef typename _Sequence::reference reference;
148 typedef typename _Sequence::const_reference const_reference;
149 typedef typename _Sequence::size_type size_type;
150 typedef _Sequence container_type;
167#if __cplusplus < 201103L
169 queue(
const _Sequence& __c = _Sequence())
172 template<
typename _Seq = _Sequence,
typename _Requires =
typename
178 queue(
const _Sequence& __c)
182 queue(_Sequence&& __c)
185 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
187 queue(
const _Alloc& __a)
190 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
191 queue(
const _Sequence& __c,
const _Alloc& __a)
194 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
195 queue(_Sequence&& __c,
const _Alloc& __a)
196 :
c(std::
move(__c), __a) { }
198 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
202 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
204 :
c(std::
move(__q.
c), __a) { }
207#ifdef __glibcxx_adaptor_iterator_pair_constructor
208 template<
typename _InputIterator,
209 typename = _RequireInputIter<_InputIterator>>
210 queue(_InputIterator __first, _InputIterator __last)
211 :
c(__first, __last) { }
213 template<
typename _InputIterator,
typename _Alloc,
214 typename = _RequireInputIter<_InputIterator>,
215 typename = _Uses<_Alloc>>
216 queue(_InputIterator __first, _InputIterator __last,
const _Alloc& __a)
217 :
c(__first, __last, __a) { }
220#if __glibcxx_containers_ranges
225 template<__detail::__container_compatible_range<_Tp> _Rg>
226 queue(from_range_t, _Rg&& __rg)
227 :
c(ranges::to<_Sequence>(std::
forward<_Rg>(__rg)))
234 template<__detail::__container_compatible_range<_Tp> _Rg,
236 queue(from_range_t, _Rg&& __rg,
const _Alloc& __a)
237 :
c(ranges::to<_Sequence>(std::
forward<_Rg>(__rg), __a))
244 _GLIBCXX_NODISCARD
bool
246 {
return c.empty(); }
262 __glibcxx_requires_nonempty();
274 __glibcxx_requires_nonempty();
286 __glibcxx_requires_nonempty();
298 __glibcxx_requires_nonempty();
313 {
c.push_back(__x); }
315#if __cplusplus >= 201103L
320#if __cplusplus > 201402L
321 template<
typename... _Args>
323 emplace(_Args&&... __args)
326 template<
typename... _Args>
328 emplace(_Args&&... __args)
333#if __glibcxx_containers_ranges
334 template<__detail::__container_compatible_range<_Tp> _Rg>
336 push_range(_Rg&& __rg)
359 __glibcxx_requires_nonempty();
363#if __cplusplus >= 201103L
366#if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
367 noexcept(__is_nothrow_swappable<_Sequence>::value)
369 noexcept(__is_nothrow_swappable<_Tp>::value)
377#if __glibcxx_format_ranges
378 friend class formatter<
queue<_Tp, _Sequence>, char>;
379 friend class formatter<
queue<_Tp, _Sequence>, wchar_t>;
554#ifdef _GLIBCXX_CONCEPT_CHECKS
556 typedef typename _Sequence::value_type _Sequence_value_type;
557# if __cplusplus < 201103L
558 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
560 __glibcxx_class_requires(_Sequence, _SequenceConcept)
561 __glibcxx_class_requires(_Sequence, _RandomAccessContainerConcept)
562 __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
563 __glibcxx_class_requires4(_Compare,
bool, _Tp, _Tp,
564 _BinaryFunctionConcept)
567#if __cplusplus >= 201103L
568 template<
typename _Alloc>
569 using _Uses =
typename
572#if __cplusplus >= 201703L
577 "value_type must be the same as the underlying container");
582 typedef typename _Sequence::value_type value_type;
583 typedef typename _Sequence::reference reference;
584 typedef typename _Sequence::const_reference const_reference;
585 typedef typename _Sequence::size_type size_type;
586 typedef _Sequence container_type;
589 typedef _Compare value_compare;
600#if __cplusplus < 201103L
603 const _Sequence& __s = _Sequence())
605 { std::make_heap(c.begin(), c.end(), comp); }
607 template<
typename _Seq = _Sequence,
typename _Requires =
typename
618 { std::make_heap(c.begin(), c.end(), comp); }
622 priority_queue(
const _Compare& __x, _Sequence&& __s = _Sequence())
624 { std::make_heap(c.begin(), c.end(), comp); }
631 noexcept(__and_<is_nothrow_move_constructible<_Sequence>,
632 is_nothrow_move_constructible<_Compare>>::value)
633 : c(std::
move(__q.c)), comp(std::
move(__q.comp))
639 noexcept(__and_<is_nothrow_move_assignable<_Sequence>,
640 is_nothrow_move_assignable<_Compare>>::value)
648 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
654 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
657 : c(__a), comp(__x) { }
661 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
665 : c(__c, __a), comp(__x)
666 { std::make_heap(c.begin(), c.end(), comp); }
668 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
670 priority_queue(
const _Compare& __x, _Sequence&& __c,
const _Alloc& __a)
671 : c(std::
move(__c), __a), comp(__x)
672 { std::make_heap(c.begin(), c.end(), comp); }
674 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
677 : c(__q.c, __a), comp(__q.comp) { }
679 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
682 : c(std::
move(__q.c), __a), comp(std::
move(__q.comp))
702#if __cplusplus < 201103L
703 template<
typename _InputIterator>
705 const _Compare& __x = _Compare(),
706 const _Sequence& __s = _Sequence())
709 __glibcxx_requires_valid_range(__first, __last);
710 c.insert(c.end(), __first, __last);
711 std::make_heap(c.begin(), c.end(), comp);
716 template<
typename _InputIterator,
717 typename = std::_RequireInputIter<_InputIterator>>
720 const _Compare& __x = _Compare())
721 : c(__first, __last), comp(__x)
722 { std::make_heap(c.begin(), c.end(), comp); }
726 template<
typename _InputIterator,
727 typename = std::_RequireInputIter<_InputIterator>>
730 const _Compare& __x,
const _Sequence& __s)
733 __glibcxx_requires_valid_range(__first, __last);
734 c.insert(c.end(), __first, __last);
735 std::make_heap(c.begin(), c.end(), comp);
738 template<
typename _InputIterator,
739 typename = std::_RequireInputIter<_InputIterator>>
742 const _Compare& __x, _Sequence&& __s)
745 __glibcxx_requires_valid_range(__first, __last);
746 c.insert(c.end(), __first, __last);
747 std::make_heap(c.begin(), c.end(), comp);
752#if __cplusplus >= 201103L
755 template<
typename _InputIterator,
typename _Alloc,
756 typename = std::_RequireInputIter<_InputIterator>,
757 typename _Requires = _Uses<_Alloc>>
760 const _Alloc& __alloc)
761 : c(__first, __last, __alloc), comp()
762 { std::make_heap(c.begin(), c.end(), comp); }
764 template<
typename _InputIterator,
typename _Alloc,
765 typename = std::_RequireInputIter<_InputIterator>,
766 typename _Requires = _Uses<_Alloc>>
769 const _Compare& __x,
const _Alloc& __alloc)
770 : c(__first, __last, __alloc), comp(__x)
771 { std::make_heap(c.begin(), c.end(), comp); }
773 template<
typename _InputIterator,
typename _Alloc,
774 typename = std::_RequireInputIter<_InputIterator>,
775 typename _Requires = _Uses<_Alloc>>
778 const _Compare& __x,
const _Sequence& __s,
779 const _Alloc& __alloc)
780 : c(__s, __alloc), comp(__x)
782 __glibcxx_requires_valid_range(__first, __last);
783 c.insert(c.end(), __first, __last);
784 std::make_heap(c.begin(), c.end(), comp);
787 template<
typename _InputIterator,
typename _Alloc,
788 typename _Requires = _Uses<_Alloc>>
791 const _Compare& __x, _Sequence&& __s,
792 const _Alloc& __alloc)
793 : c(std::
move(__s), __alloc), comp(__x)
795 __glibcxx_requires_valid_range(__first, __last);
796 c.insert(c.end(), __first, __last);
797 std::make_heap(c.begin(), c.end(), comp);
801#if __glibcxx_containers_ranges
808 template<__detail::__container_compatible_range<_Tp> _Rg>
811 const _Compare& __x = _Compare())
812 : c(ranges::to<_Sequence>(std::
forward<_Rg>(__rg))), comp(__x)
813 { std::make_heap(c.begin(), c.end(), comp); }
815 template<__detail::__container_compatible_range<_Tp> _Rg,
typename _Alloc>
819 : c(ranges::to<_Sequence>(std::
forward<_Rg>(__rg), __a)), comp(__x)
820 { std::make_heap(c.begin(), c.end(), comp); }
822 template<__detail::__container_compatible_range<_Tp> _Rg,
typename _Alloc>
825 : c(ranges::to<_Sequence>(std::
forward<_Rg>(__rg), __a)), comp()
826 { std::make_heap(c.begin(), c.end(), comp); }
833 _GLIBCXX_NODISCARD _GLIBCXX26_CONSTEXPR
836 {
return c.empty(); }
839 _GLIBCXX_NODISCARD _GLIBCXX26_CONSTEXPR
848 _GLIBCXX_NODISCARD _GLIBCXX26_CONSTEXPR
852 __glibcxx_requires_nonempty();
869 std::push_heap(c.begin(), c.end(), comp);
872#if __cplusplus >= 201103L
878 std::push_heap(c.begin(), c.end(), comp);
881 template<
typename... _Args>
884 emplace(_Args&&... __args)
887 std::push_heap(c.begin(), c.end(), comp);
891#if __glibcxx_containers_ranges
892 template<__detail::__container_compatible_range<_Tp> _Rg>
895 push_range(_Rg&& __rg)
901 std::make_heap(c.begin(), c.end(), comp);
920 __glibcxx_requires_nonempty();
921 std::pop_heap(c.begin(), c.end(), comp);
925#if __cplusplus >= 201103L
930#if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
931 __is_nothrow_swappable<_Sequence>,
933 __is_nothrow_swappable<_Tp>,
935 __is_nothrow_swappable<_Compare>
940 swap(comp, __pq.comp);
944#if __glibcxx_format_ranges
945 friend class formatter<
priority_queue<_Tp, _Sequence, _Compare>, char>;
946 friend class formatter<
priority_queue<_Tp, _Sequence, _Compare>, wchar_t>;