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>
118 friend _GLIBCXX26_CONSTEXPR
bool
121 template<
typename _Tp1,
typename _Seq1>
122 friend _GLIBCXX26_CONSTEXPR
bool
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 explicit _GLIBCXX26_CONSTEXPR
179 queue(
const _Sequence& __c)
182 explicit _GLIBCXX26_CONSTEXPR
183 queue(_Sequence&& __c)
186 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
187 explicit _GLIBCXX26_CONSTEXPR
188 queue(
const _Alloc& __a)
191 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
193 queue(
const _Sequence& __c,
const _Alloc& __a)
196 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
198 queue(_Sequence&& __c,
const _Alloc& __a)
199 :
c(std::
move(__c), __a) { }
201 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
206 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
209 :
c(std::
move(__q.
c), __a) { }
212#ifdef __glibcxx_adaptor_iterator_pair_constructor
213 template<
typename _InputIterator,
214 typename = _RequireInputIter<_InputIterator>>
216 queue(_InputIterator __first, _InputIterator __last)
217 :
c(__first, __last) { }
219 template<
typename _InputIterator,
typename _Alloc,
220 typename = _RequireInputIter<_InputIterator>,
221 typename = _Uses<_Alloc>>
223 queue(_InputIterator __first, _InputIterator __last,
const _Alloc& __a)
224 :
c(__first, __last, __a) { }
227#if __glibcxx_containers_ranges
232 template<__detail::__container_compatible_range<_Tp> _Rg>
234 queue(from_range_t, _Rg&& __rg)
235 :
c(ranges::to<_Sequence>(std::
forward<_Rg>(__rg)))
242 template<__detail::__container_compatible_range<_Tp> _Rg,
245 queue(from_range_t, _Rg&& __rg,
const _Alloc& __a)
246 :
c(ranges::to<_Sequence>(std::
forward<_Rg>(__rg), __a))
254 _GLIBCXX26_CONSTEXPR
bool
256 {
return c.empty(); }
269 _GLIBCXX26_CONSTEXPR reference
272 __glibcxx_requires_nonempty();
281 _GLIBCXX26_CONSTEXPR const_reference
284 __glibcxx_requires_nonempty();
293 _GLIBCXX26_CONSTEXPR reference
296 __glibcxx_requires_nonempty();
305 _GLIBCXX26_CONSTEXPR const_reference
308 __glibcxx_requires_nonempty();
321 _GLIBCXX26_CONSTEXPR
void
323 {
c.push_back(__x); }
325#if __cplusplus >= 201103L
326 _GLIBCXX26_CONSTEXPR
void
330#if __cplusplus > 201402L
331 template<
typename... _Args>
332 _GLIBCXX26_CONSTEXPR
decltype(
auto)
333 emplace(_Args&&... __args)
336 template<
typename... _Args>
338 emplace(_Args&&... __args)
343#if __glibcxx_containers_ranges
344 template<__detail::__container_compatible_range<_Tp> _Rg>
345 _GLIBCXX26_CONSTEXPR
void
346 push_range(_Rg&& __rg)
366 _GLIBCXX26_CONSTEXPR
void
369 __glibcxx_requires_nonempty();
373#if __cplusplus >= 201103L
374 _GLIBCXX26_CONSTEXPR
void
376#if __cplusplus > 201402L || !defined(__STRICT_ANSI__)
377 noexcept(__is_nothrow_swappable<_Sequence>::value)
379 noexcept(__is_nothrow_swappable<_Tp>::value)
387#if __glibcxx_format_ranges
388 friend class formatter<
queue<_Tp, _Sequence>, char>;
389 friend class formatter<
queue<_Tp, _Sequence>, wchar_t>;
564#ifdef _GLIBCXX_CONCEPT_CHECKS
566 typedef typename _Sequence::value_type _Sequence_value_type;
567# if __cplusplus < 201103L
568 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
570 __glibcxx_class_requires(_Sequence, _SequenceConcept)
571 __glibcxx_class_requires(_Sequence, _RandomAccessContainerConcept)
572 __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)
573 __glibcxx_class_requires4(_Compare,
bool, _Tp, _Tp,
574 _BinaryFunctionConcept)
577#if __cplusplus >= 201103L
578 template<
typename _Alloc>
579 using _Uses =
typename
582#if __cplusplus >= 201703L
587 "value_type must be the same as the underlying container");
592 typedef typename _Sequence::value_type value_type;
593 typedef typename _Sequence::reference reference;
594 typedef typename _Sequence::const_reference const_reference;
595 typedef typename _Sequence::size_type size_type;
596 typedef _Sequence container_type;
599 typedef _Compare value_compare;
610#if __cplusplus < 201103L
613 const _Sequence& __s = _Sequence())
615 { std::make_heap(c.begin(), c.end(), comp); }
617 template<
typename _Seq = _Sequence,
typename _Requires =
typename
624 explicit _GLIBCXX26_CONSTEXPR
627 { std::make_heap(c.begin(), c.end(), comp); }
629 explicit _GLIBCXX26_CONSTEXPR
630 priority_queue(
const _Compare& __x, _Sequence&& __s = _Sequence())
632 { std::make_heap(c.begin(), c.end(), comp); }
639 noexcept(__and_<is_nothrow_move_constructible<_Sequence>,
640 is_nothrow_move_constructible<_Compare>>::value)
641 : c(std::
move(__q.c)), comp(std::
move(__q.comp))
646 noexcept(__and_<is_nothrow_move_assignable<_Sequence>,
647 is_nothrow_move_assignable<_Compare>>::value)
655 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
656 explicit _GLIBCXX26_CONSTEXPR
660 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
663 : c(__a), comp(__x) { }
667 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
671 : c(__c, __a), comp(__x)
672 { std::make_heap(c.begin(), c.end(), comp); }
674 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
676 priority_queue(
const _Compare& __x, _Sequence&& __c,
const _Alloc& __a)
677 : c(std::
move(__c), __a), comp(__x)
678 { std::make_heap(c.begin(), c.end(), comp); }
680 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
683 : c(__q.c, __a), comp(__q.comp) { }
685 template<
typename _Alloc,
typename _Requires = _Uses<_Alloc>>
688 : c(std::
move(__q.c), __a), comp(std::
move(__q.comp))
708#if __cplusplus < 201103L
709 template<
typename _InputIterator>
711 const _Compare& __x = _Compare(),
712 const _Sequence& __s = _Sequence())
715 __glibcxx_requires_valid_range(__first, __last);
716 c.insert(c.end(), __first, __last);
717 std::make_heap(c.begin(), c.end(), comp);
722 template<
typename _InputIterator,
723 typename = std::_RequireInputIter<_InputIterator>>
726 const _Compare& __x = _Compare())
727 : c(__first, __last), comp(__x)
728 { std::make_heap(c.begin(), c.end(), comp); }
732 template<
typename _InputIterator,
733 typename = std::_RequireInputIter<_InputIterator>>
736 const _Compare& __x,
const _Sequence& __s)
739 __glibcxx_requires_valid_range(__first, __last);
740 c.insert(c.end(), __first, __last);
741 std::make_heap(c.begin(), c.end(), comp);
744 template<
typename _InputIterator,
745 typename = std::_RequireInputIter<_InputIterator>>
748 const _Compare& __x, _Sequence&& __s)
751 __glibcxx_requires_valid_range(__first, __last);
752 c.insert(c.end(), __first, __last);
753 std::make_heap(c.begin(), c.end(), comp);
758#if __cplusplus >= 201103L
761 template<
typename _InputIterator,
typename _Alloc,
762 typename = std::_RequireInputIter<_InputIterator>,
763 typename _Requires = _Uses<_Alloc>>
766 const _Alloc& __alloc)
767 : c(__first, __last, __alloc), comp()
768 { std::make_heap(c.begin(), c.end(), comp); }
770 template<
typename _InputIterator,
typename _Alloc,
771 typename = std::_RequireInputIter<_InputIterator>,
772 typename _Requires = _Uses<_Alloc>>
775 const _Compare& __x,
const _Alloc& __alloc)
776 : c(__first, __last, __alloc), comp(__x)
777 { std::make_heap(c.begin(), c.end(), comp); }
779 template<
typename _InputIterator,
typename _Alloc,
780 typename = std::_RequireInputIter<_InputIterator>,
781 typename _Requires = _Uses<_Alloc>>
784 const _Compare& __x,
const _Sequence& __s,
785 const _Alloc& __alloc)
786 : c(__s, __alloc), comp(__x)
788 __glibcxx_requires_valid_range(__first, __last);
789 c.insert(c.end(), __first, __last);
790 std::make_heap(c.begin(), c.end(), comp);
793 template<
typename _InputIterator,
typename _Alloc,
794 typename _Requires = _Uses<_Alloc>>
797 const _Compare& __x, _Sequence&& __s,
798 const _Alloc& __alloc)
799 : c(std::
move(__s), __alloc), comp(__x)
801 __glibcxx_requires_valid_range(__first, __last);
802 c.insert(c.end(), __first, __last);
803 std::make_heap(c.begin(), c.end(), comp);
807#if __glibcxx_containers_ranges
814 template<__detail::__container_compatible_range<_Tp> _Rg>
817 const _Compare& __x = _Compare())
818 : c(ranges::to<_Sequence>(std::
forward<_Rg>(__rg))), comp(__x)
819 { std::make_heap(c.begin(), c.end(), comp); }
821 template<__detail::__container_compatible_range<_Tp> _Rg,
typename _Alloc>
825 : c(ranges::to<_Sequence>(std::
forward<_Rg>(__rg), __a)), comp(__x)
826 { std::make_heap(c.begin(), c.end(), comp); }
828 template<__detail::__container_compatible_range<_Tp> _Rg,
typename _Alloc>
831 : c(ranges::to<_Sequence>(std::
forward<_Rg>(__rg), __a)), comp()
832 { std::make_heap(c.begin(), c.end(), comp); }
840 _GLIBCXX26_CONSTEXPR
bool
842 {
return c.empty(); }
855 _GLIBCXX26_CONSTEXPR const_reference
858 __glibcxx_requires_nonempty();
870 _GLIBCXX26_CONSTEXPR
void
874 std::push_heap(c.begin(), c.end(), comp);
877#if __cplusplus >= 201103L
878 _GLIBCXX26_CONSTEXPR
void
882 std::push_heap(c.begin(), c.end(), comp);
885 template<
typename... _Args>
886 _GLIBCXX26_CONSTEXPR
void
887 emplace(_Args&&... __args)
890 std::push_heap(c.begin(), c.end(), comp);
894#if __glibcxx_containers_ranges
895 template<__detail::__container_compatible_range<_Tp> _Rg>
896 _GLIBCXX26_CONSTEXPR
void
897 push_range(_Rg&& __rg)
903 std::make_heap(c.begin(), c.end(), comp);
918 _GLIBCXX26_CONSTEXPR
void
921 __glibcxx_requires_nonempty();
922 std::pop_heap(c.begin(), c.end(), comp);
926#if __cplusplus >= 201103L
927 _GLIBCXX26_CONSTEXPR
void
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>;