1*4d6fc14bSjoerg// -*- C++ -*- 2*4d6fc14bSjoerg//===--------------------------- queue ------------------------------------===// 3*4d6fc14bSjoerg// 4*4d6fc14bSjoerg// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5*4d6fc14bSjoerg// See https://llvm.org/LICENSE.txt for license information. 6*4d6fc14bSjoerg// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7*4d6fc14bSjoerg// 8*4d6fc14bSjoerg//===----------------------------------------------------------------------===// 9*4d6fc14bSjoerg 10*4d6fc14bSjoerg#ifndef _LIBCPP_QUEUE 11*4d6fc14bSjoerg#define _LIBCPP_QUEUE 12*4d6fc14bSjoerg 13*4d6fc14bSjoerg/* 14*4d6fc14bSjoerg queue synopsis 15*4d6fc14bSjoerg 16*4d6fc14bSjoergnamespace std 17*4d6fc14bSjoerg{ 18*4d6fc14bSjoerg 19*4d6fc14bSjoergtemplate <class T, class Container = deque<T>> 20*4d6fc14bSjoergclass queue 21*4d6fc14bSjoerg{ 22*4d6fc14bSjoergpublic: 23*4d6fc14bSjoerg typedef Container container_type; 24*4d6fc14bSjoerg typedef typename container_type::value_type value_type; 25*4d6fc14bSjoerg typedef typename container_type::reference reference; 26*4d6fc14bSjoerg typedef typename container_type::const_reference const_reference; 27*4d6fc14bSjoerg typedef typename container_type::size_type size_type; 28*4d6fc14bSjoerg 29*4d6fc14bSjoergprotected: 30*4d6fc14bSjoerg container_type c; 31*4d6fc14bSjoerg 32*4d6fc14bSjoergpublic: 33*4d6fc14bSjoerg queue() = default; 34*4d6fc14bSjoerg ~queue() = default; 35*4d6fc14bSjoerg 36*4d6fc14bSjoerg queue(const queue& q) = default; 37*4d6fc14bSjoerg queue(queue&& q) = default; 38*4d6fc14bSjoerg 39*4d6fc14bSjoerg queue& operator=(const queue& q) = default; 40*4d6fc14bSjoerg queue& operator=(queue&& q) = default; 41*4d6fc14bSjoerg 42*4d6fc14bSjoerg explicit queue(const container_type& c); 43*4d6fc14bSjoerg explicit queue(container_type&& c) 44*4d6fc14bSjoerg template <class Alloc> 45*4d6fc14bSjoerg explicit queue(const Alloc& a); 46*4d6fc14bSjoerg template <class Alloc> 47*4d6fc14bSjoerg queue(const container_type& c, const Alloc& a); 48*4d6fc14bSjoerg template <class Alloc> 49*4d6fc14bSjoerg queue(container_type&& c, const Alloc& a); 50*4d6fc14bSjoerg template <class Alloc> 51*4d6fc14bSjoerg queue(const queue& q, const Alloc& a); 52*4d6fc14bSjoerg template <class Alloc> 53*4d6fc14bSjoerg queue(queue&& q, const Alloc& a); 54*4d6fc14bSjoerg 55*4d6fc14bSjoerg bool empty() const; 56*4d6fc14bSjoerg size_type size() const; 57*4d6fc14bSjoerg 58*4d6fc14bSjoerg reference front(); 59*4d6fc14bSjoerg const_reference front() const; 60*4d6fc14bSjoerg reference back(); 61*4d6fc14bSjoerg const_reference back() const; 62*4d6fc14bSjoerg 63*4d6fc14bSjoerg void push(const value_type& v); 64*4d6fc14bSjoerg void push(value_type&& v); 65*4d6fc14bSjoerg template <class... Args> reference emplace(Args&&... args); // reference in C++17 66*4d6fc14bSjoerg void pop(); 67*4d6fc14bSjoerg 68*4d6fc14bSjoerg void swap(queue& q) noexcept(is_nothrow_swappable_v<Container>) 69*4d6fc14bSjoerg}; 70*4d6fc14bSjoerg 71*4d6fc14bSjoergtemplate<class Container> 72*4d6fc14bSjoerg queue(Container) -> queue<typename Container::value_type, Container>; // C++17 73*4d6fc14bSjoerg 74*4d6fc14bSjoergtemplate<class Container, class Allocator> 75*4d6fc14bSjoerg queue(Container, Allocator) -> queue<typename Container::value_type, Container>; // C++17 76*4d6fc14bSjoerg 77*4d6fc14bSjoergtemplate <class T, class Container> 78*4d6fc14bSjoerg bool operator==(const queue<T, Container>& x,const queue<T, Container>& y); 79*4d6fc14bSjoerg 80*4d6fc14bSjoergtemplate <class T, class Container> 81*4d6fc14bSjoerg bool operator< (const queue<T, Container>& x,const queue<T, Container>& y); 82*4d6fc14bSjoerg 83*4d6fc14bSjoergtemplate <class T, class Container> 84*4d6fc14bSjoerg bool operator!=(const queue<T, Container>& x,const queue<T, Container>& y); 85*4d6fc14bSjoerg 86*4d6fc14bSjoergtemplate <class T, class Container> 87*4d6fc14bSjoerg bool operator> (const queue<T, Container>& x,const queue<T, Container>& y); 88*4d6fc14bSjoerg 89*4d6fc14bSjoergtemplate <class T, class Container> 90*4d6fc14bSjoerg bool operator>=(const queue<T, Container>& x,const queue<T, Container>& y); 91*4d6fc14bSjoerg 92*4d6fc14bSjoergtemplate <class T, class Container> 93*4d6fc14bSjoerg bool operator<=(const queue<T, Container>& x,const queue<T, Container>& y); 94*4d6fc14bSjoerg 95*4d6fc14bSjoergtemplate <class T, class Container> 96*4d6fc14bSjoerg void swap(queue<T, Container>& x, queue<T, Container>& y) 97*4d6fc14bSjoerg noexcept(noexcept(x.swap(y))); 98*4d6fc14bSjoerg 99*4d6fc14bSjoergtemplate <class T, class Container = vector<T>, 100*4d6fc14bSjoerg class Compare = less<typename Container::value_type>> 101*4d6fc14bSjoergclass priority_queue 102*4d6fc14bSjoerg{ 103*4d6fc14bSjoergpublic: 104*4d6fc14bSjoerg typedef Container container_type; 105*4d6fc14bSjoerg typedef typename container_type::value_type value_type; 106*4d6fc14bSjoerg typedef typename container_type::reference reference; 107*4d6fc14bSjoerg typedef typename container_type::const_reference const_reference; 108*4d6fc14bSjoerg typedef typename container_type::size_type size_type; 109*4d6fc14bSjoerg 110*4d6fc14bSjoergprotected: 111*4d6fc14bSjoerg container_type c; 112*4d6fc14bSjoerg Compare comp; 113*4d6fc14bSjoerg 114*4d6fc14bSjoergpublic: 115*4d6fc14bSjoerg priority_queue() : priority_queue(Compare()) {} // C++20 116*4d6fc14bSjoerg explicit priority_queue(const Compare& x) : priority_queue(x, Container()) {} 117*4d6fc14bSjoerg priority_queue(const Compare& x, const Container&); 118*4d6fc14bSjoerg explicit priority_queue(const Compare& x = Compare(), Container&&= Container()); // before C++20 119*4d6fc14bSjoerg priority_queue(const Compare& x, Container&&); // C++20 120*4d6fc14bSjoerg template <class InputIterator> 121*4d6fc14bSjoerg priority_queue(InputIterator first, InputIterator last, 122*4d6fc14bSjoerg const Compare& comp = Compare()); 123*4d6fc14bSjoerg template <class InputIterator> 124*4d6fc14bSjoerg priority_queue(InputIterator first, InputIterator last, 125*4d6fc14bSjoerg const Compare& comp, const container_type& c); 126*4d6fc14bSjoerg template <class InputIterator> 127*4d6fc14bSjoerg priority_queue(InputIterator first, InputIterator last, 128*4d6fc14bSjoerg const Compare& comp, container_type&& c); 129*4d6fc14bSjoerg template <class Alloc> 130*4d6fc14bSjoerg explicit priority_queue(const Alloc& a); 131*4d6fc14bSjoerg template <class Alloc> 132*4d6fc14bSjoerg priority_queue(const Compare& comp, const Alloc& a); 133*4d6fc14bSjoerg template <class Alloc> 134*4d6fc14bSjoerg priority_queue(const Compare& comp, const container_type& c, 135*4d6fc14bSjoerg const Alloc& a); 136*4d6fc14bSjoerg template <class Alloc> 137*4d6fc14bSjoerg priority_queue(const Compare& comp, container_type&& c, 138*4d6fc14bSjoerg const Alloc& a); 139*4d6fc14bSjoerg template <class Alloc> 140*4d6fc14bSjoerg priority_queue(const priority_queue& q, const Alloc& a); 141*4d6fc14bSjoerg template <class Alloc> 142*4d6fc14bSjoerg priority_queue(priority_queue&& q, const Alloc& a); 143*4d6fc14bSjoerg 144*4d6fc14bSjoerg bool empty() const; 145*4d6fc14bSjoerg size_type size() const; 146*4d6fc14bSjoerg const_reference top() const; 147*4d6fc14bSjoerg 148*4d6fc14bSjoerg void push(const value_type& v); 149*4d6fc14bSjoerg void push(value_type&& v); 150*4d6fc14bSjoerg template <class... Args> void emplace(Args&&... args); 151*4d6fc14bSjoerg void pop(); 152*4d6fc14bSjoerg 153*4d6fc14bSjoerg void swap(priority_queue& q) 154*4d6fc14bSjoerg noexcept(is_nothrow_swappable_v<Container> && 155*4d6fc14bSjoerg is_nothrow_swappable_v<Comp>) 156*4d6fc14bSjoerg}; 157*4d6fc14bSjoerg 158*4d6fc14bSjoergtemplate <class Compare, class Container> 159*4d6fc14bSjoergpriority_queue(Compare, Container) 160*4d6fc14bSjoerg -> priority_queue<typename Container::value_type, Container, Compare>; // C++17 161*4d6fc14bSjoerg 162*4d6fc14bSjoergtemplate<class InputIterator, 163*4d6fc14bSjoerg class Compare = less<typename iterator_traits<InputIterator>::value_type>, 164*4d6fc14bSjoerg class Container = vector<typename iterator_traits<InputIterator>::value_type>> 165*4d6fc14bSjoergpriority_queue(InputIterator, InputIterator, Compare = Compare(), Container = Container()) 166*4d6fc14bSjoerg -> priority_queue<typename iterator_traits<InputIterator>::value_type, Container, Compare>; // C++17 167*4d6fc14bSjoerg 168*4d6fc14bSjoergtemplate<class Compare, class Container, class Allocator> 169*4d6fc14bSjoergpriority_queue(Compare, Container, Allocator) 170*4d6fc14bSjoerg -> priority_queue<typename Container::value_type, Container, Compare>; // C++17 171*4d6fc14bSjoerg 172*4d6fc14bSjoergtemplate <class T, class Container, class Compare> 173*4d6fc14bSjoerg void swap(priority_queue<T, Container, Compare>& x, 174*4d6fc14bSjoerg priority_queue<T, Container, Compare>& y) 175*4d6fc14bSjoerg noexcept(noexcept(x.swap(y))); 176*4d6fc14bSjoerg 177*4d6fc14bSjoerg} // std 178*4d6fc14bSjoerg 179*4d6fc14bSjoerg*/ 180*4d6fc14bSjoerg 181*4d6fc14bSjoerg#include <__config> 182*4d6fc14bSjoerg#include <compare> 183*4d6fc14bSjoerg#include <deque> 184*4d6fc14bSjoerg#include <vector> 185*4d6fc14bSjoerg#include <functional> 186*4d6fc14bSjoerg#include <algorithm> 187*4d6fc14bSjoerg 188*4d6fc14bSjoerg#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 189*4d6fc14bSjoerg#pragma GCC system_header 190*4d6fc14bSjoerg#endif 191*4d6fc14bSjoerg 192*4d6fc14bSjoerg_LIBCPP_BEGIN_NAMESPACE_STD 193*4d6fc14bSjoerg 194*4d6fc14bSjoergtemplate <class _Tp, class _Container = deque<_Tp> > class _LIBCPP_TEMPLATE_VIS queue; 195*4d6fc14bSjoerg 196*4d6fc14bSjoergtemplate <class _Tp, class _Container> 197*4d6fc14bSjoerg_LIBCPP_INLINE_VISIBILITY 198*4d6fc14bSjoergbool 199*4d6fc14bSjoergoperator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y); 200*4d6fc14bSjoerg 201*4d6fc14bSjoergtemplate <class _Tp, class _Container> 202*4d6fc14bSjoerg_LIBCPP_INLINE_VISIBILITY 203*4d6fc14bSjoergbool 204*4d6fc14bSjoergoperator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y); 205*4d6fc14bSjoerg 206*4d6fc14bSjoergtemplate <class _Tp, class _Container /*= deque<_Tp>*/> 207*4d6fc14bSjoergclass _LIBCPP_TEMPLATE_VIS queue 208*4d6fc14bSjoerg{ 209*4d6fc14bSjoergpublic: 210*4d6fc14bSjoerg typedef _Container container_type; 211*4d6fc14bSjoerg typedef typename container_type::value_type value_type; 212*4d6fc14bSjoerg typedef typename container_type::reference reference; 213*4d6fc14bSjoerg typedef typename container_type::const_reference const_reference; 214*4d6fc14bSjoerg typedef typename container_type::size_type size_type; 215*4d6fc14bSjoerg static_assert((is_same<_Tp, value_type>::value), "" ); 216*4d6fc14bSjoerg 217*4d6fc14bSjoergprotected: 218*4d6fc14bSjoerg container_type c; 219*4d6fc14bSjoerg 220*4d6fc14bSjoergpublic: 221*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 222*4d6fc14bSjoerg queue() 223*4d6fc14bSjoerg _NOEXCEPT_(is_nothrow_default_constructible<container_type>::value) 224*4d6fc14bSjoerg : c() {} 225*4d6fc14bSjoerg 226*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 227*4d6fc14bSjoerg queue(const queue& __q) : c(__q.c) {} 228*4d6fc14bSjoerg 229*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 230*4d6fc14bSjoerg queue& operator=(const queue& __q) {c = __q.c; return *this;} 231*4d6fc14bSjoerg 232*4d6fc14bSjoerg#ifndef _LIBCPP_CXX03_LANG 233*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 234*4d6fc14bSjoerg queue(queue&& __q) 235*4d6fc14bSjoerg _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value) 236*4d6fc14bSjoerg : c(_VSTD::move(__q.c)) {} 237*4d6fc14bSjoerg 238*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 239*4d6fc14bSjoerg queue& operator=(queue&& __q) 240*4d6fc14bSjoerg _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value) 241*4d6fc14bSjoerg {c = _VSTD::move(__q.c); return *this;} 242*4d6fc14bSjoerg#endif // _LIBCPP_CXX03_LANG 243*4d6fc14bSjoerg 244*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 245*4d6fc14bSjoerg explicit queue(const container_type& __c) : c(__c) {} 246*4d6fc14bSjoerg#ifndef _LIBCPP_CXX03_LANG 247*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 248*4d6fc14bSjoerg explicit queue(container_type&& __c) : c(_VSTD::move(__c)) {} 249*4d6fc14bSjoerg#endif // _LIBCPP_CXX03_LANG 250*4d6fc14bSjoerg template <class _Alloc> 251*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 252*4d6fc14bSjoerg explicit queue(const _Alloc& __a, 253*4d6fc14bSjoerg _EnableIf<uses_allocator<container_type, _Alloc>::value>* = 0) 254*4d6fc14bSjoerg : c(__a) {} 255*4d6fc14bSjoerg template <class _Alloc> 256*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 257*4d6fc14bSjoerg queue(const queue& __q, const _Alloc& __a, 258*4d6fc14bSjoerg _EnableIf<uses_allocator<container_type, _Alloc>::value>* = 0) 259*4d6fc14bSjoerg : c(__q.c, __a) {} 260*4d6fc14bSjoerg template <class _Alloc> 261*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 262*4d6fc14bSjoerg queue(const container_type& __c, const _Alloc& __a, 263*4d6fc14bSjoerg _EnableIf<uses_allocator<container_type, _Alloc>::value>* = 0) 264*4d6fc14bSjoerg : c(__c, __a) {} 265*4d6fc14bSjoerg#ifndef _LIBCPP_CXX03_LANG 266*4d6fc14bSjoerg template <class _Alloc> 267*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 268*4d6fc14bSjoerg queue(container_type&& __c, const _Alloc& __a, 269*4d6fc14bSjoerg _EnableIf<uses_allocator<container_type, _Alloc>::value>* = 0) 270*4d6fc14bSjoerg : c(_VSTD::move(__c), __a) {} 271*4d6fc14bSjoerg template <class _Alloc> 272*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 273*4d6fc14bSjoerg queue(queue&& __q, const _Alloc& __a, 274*4d6fc14bSjoerg _EnableIf<uses_allocator<container_type, _Alloc>::value>* = 0) 275*4d6fc14bSjoerg : c(_VSTD::move(__q.c), __a) {} 276*4d6fc14bSjoerg 277*4d6fc14bSjoerg#endif // _LIBCPP_CXX03_LANG 278*4d6fc14bSjoerg 279*4d6fc14bSjoerg _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY 280*4d6fc14bSjoerg bool empty() const {return c.empty();} 281*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 282*4d6fc14bSjoerg size_type size() const {return c.size();} 283*4d6fc14bSjoerg 284*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 285*4d6fc14bSjoerg reference front() {return c.front();} 286*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 287*4d6fc14bSjoerg const_reference front() const {return c.front();} 288*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 289*4d6fc14bSjoerg reference back() {return c.back();} 290*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 291*4d6fc14bSjoerg const_reference back() const {return c.back();} 292*4d6fc14bSjoerg 293*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 294*4d6fc14bSjoerg void push(const value_type& __v) {c.push_back(__v);} 295*4d6fc14bSjoerg#ifndef _LIBCPP_CXX03_LANG 296*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 297*4d6fc14bSjoerg void push(value_type&& __v) {c.push_back(_VSTD::move(__v));} 298*4d6fc14bSjoerg template <class... _Args> 299*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 300*4d6fc14bSjoerg#if _LIBCPP_STD_VER > 14 301*4d6fc14bSjoerg decltype(auto) emplace(_Args&&... __args) 302*4d6fc14bSjoerg { return c.emplace_back(_VSTD::forward<_Args>(__args)...);} 303*4d6fc14bSjoerg#else 304*4d6fc14bSjoerg void emplace(_Args&&... __args) 305*4d6fc14bSjoerg { c.emplace_back(_VSTD::forward<_Args>(__args)...);} 306*4d6fc14bSjoerg#endif 307*4d6fc14bSjoerg#endif // _LIBCPP_CXX03_LANG 308*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 309*4d6fc14bSjoerg void pop() {c.pop_front();} 310*4d6fc14bSjoerg 311*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 312*4d6fc14bSjoerg void swap(queue& __q) 313*4d6fc14bSjoerg _NOEXCEPT_(__is_nothrow_swappable<container_type>::value) 314*4d6fc14bSjoerg { 315*4d6fc14bSjoerg using _VSTD::swap; 316*4d6fc14bSjoerg swap(c, __q.c); 317*4d6fc14bSjoerg } 318*4d6fc14bSjoerg 319*4d6fc14bSjoerg template <class _T1, class _C1> 320*4d6fc14bSjoerg friend 321*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 322*4d6fc14bSjoerg bool 323*4d6fc14bSjoerg operator==(const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y); 324*4d6fc14bSjoerg 325*4d6fc14bSjoerg template <class _T1, class _C1> 326*4d6fc14bSjoerg friend 327*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 328*4d6fc14bSjoerg bool 329*4d6fc14bSjoerg operator< (const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y); 330*4d6fc14bSjoerg}; 331*4d6fc14bSjoerg 332*4d6fc14bSjoerg#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES 333*4d6fc14bSjoergtemplate<class _Container, 334*4d6fc14bSjoerg class = _EnableIf<!__is_allocator<_Container>::value> 335*4d6fc14bSjoerg> 336*4d6fc14bSjoergqueue(_Container) 337*4d6fc14bSjoerg -> queue<typename _Container::value_type, _Container>; 338*4d6fc14bSjoerg 339*4d6fc14bSjoergtemplate<class _Container, 340*4d6fc14bSjoerg class _Alloc, 341*4d6fc14bSjoerg class = _EnableIf<!__is_allocator<_Container>::value>, 342*4d6fc14bSjoerg class = _EnableIf<__is_allocator<_Alloc>::value> 343*4d6fc14bSjoerg> 344*4d6fc14bSjoergqueue(_Container, _Alloc) 345*4d6fc14bSjoerg -> queue<typename _Container::value_type, _Container>; 346*4d6fc14bSjoerg#endif 347*4d6fc14bSjoerg 348*4d6fc14bSjoergtemplate <class _Tp, class _Container> 349*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY 350*4d6fc14bSjoergbool 351*4d6fc14bSjoergoperator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) 352*4d6fc14bSjoerg{ 353*4d6fc14bSjoerg return __x.c == __y.c; 354*4d6fc14bSjoerg} 355*4d6fc14bSjoerg 356*4d6fc14bSjoergtemplate <class _Tp, class _Container> 357*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY 358*4d6fc14bSjoergbool 359*4d6fc14bSjoergoperator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) 360*4d6fc14bSjoerg{ 361*4d6fc14bSjoerg return __x.c < __y.c; 362*4d6fc14bSjoerg} 363*4d6fc14bSjoerg 364*4d6fc14bSjoergtemplate <class _Tp, class _Container> 365*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY 366*4d6fc14bSjoergbool 367*4d6fc14bSjoergoperator!=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) 368*4d6fc14bSjoerg{ 369*4d6fc14bSjoerg return !(__x == __y); 370*4d6fc14bSjoerg} 371*4d6fc14bSjoerg 372*4d6fc14bSjoergtemplate <class _Tp, class _Container> 373*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY 374*4d6fc14bSjoergbool 375*4d6fc14bSjoergoperator> (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) 376*4d6fc14bSjoerg{ 377*4d6fc14bSjoerg return __y < __x; 378*4d6fc14bSjoerg} 379*4d6fc14bSjoerg 380*4d6fc14bSjoergtemplate <class _Tp, class _Container> 381*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY 382*4d6fc14bSjoergbool 383*4d6fc14bSjoergoperator>=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) 384*4d6fc14bSjoerg{ 385*4d6fc14bSjoerg return !(__x < __y); 386*4d6fc14bSjoerg} 387*4d6fc14bSjoerg 388*4d6fc14bSjoergtemplate <class _Tp, class _Container> 389*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY 390*4d6fc14bSjoergbool 391*4d6fc14bSjoergoperator<=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) 392*4d6fc14bSjoerg{ 393*4d6fc14bSjoerg return !(__y < __x); 394*4d6fc14bSjoerg} 395*4d6fc14bSjoerg 396*4d6fc14bSjoergtemplate <class _Tp, class _Container> 397*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY 398*4d6fc14bSjoerg_EnableIf<__is_swappable<_Container>::value, void> 399*4d6fc14bSjoergswap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y) 400*4d6fc14bSjoerg _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) 401*4d6fc14bSjoerg{ 402*4d6fc14bSjoerg __x.swap(__y); 403*4d6fc14bSjoerg} 404*4d6fc14bSjoerg 405*4d6fc14bSjoergtemplate <class _Tp, class _Container, class _Alloc> 406*4d6fc14bSjoergstruct _LIBCPP_TEMPLATE_VIS uses_allocator<queue<_Tp, _Container>, _Alloc> 407*4d6fc14bSjoerg : public uses_allocator<_Container, _Alloc> 408*4d6fc14bSjoerg{ 409*4d6fc14bSjoerg}; 410*4d6fc14bSjoerg 411*4d6fc14bSjoergtemplate <class _Tp, class _Container = vector<_Tp>, 412*4d6fc14bSjoerg class _Compare = less<typename _Container::value_type> > 413*4d6fc14bSjoergclass _LIBCPP_TEMPLATE_VIS priority_queue 414*4d6fc14bSjoerg{ 415*4d6fc14bSjoergpublic: 416*4d6fc14bSjoerg typedef _Container container_type; 417*4d6fc14bSjoerg typedef _Compare value_compare; 418*4d6fc14bSjoerg typedef typename container_type::value_type value_type; 419*4d6fc14bSjoerg typedef typename container_type::reference reference; 420*4d6fc14bSjoerg typedef typename container_type::const_reference const_reference; 421*4d6fc14bSjoerg typedef typename container_type::size_type size_type; 422*4d6fc14bSjoerg static_assert((is_same<_Tp, value_type>::value), "" ); 423*4d6fc14bSjoerg 424*4d6fc14bSjoergprotected: 425*4d6fc14bSjoerg container_type c; 426*4d6fc14bSjoerg value_compare comp; 427*4d6fc14bSjoerg 428*4d6fc14bSjoergpublic: 429*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 430*4d6fc14bSjoerg priority_queue() 431*4d6fc14bSjoerg _NOEXCEPT_(is_nothrow_default_constructible<container_type>::value && 432*4d6fc14bSjoerg is_nothrow_default_constructible<value_compare>::value) 433*4d6fc14bSjoerg : c(), comp() {} 434*4d6fc14bSjoerg 435*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 436*4d6fc14bSjoerg priority_queue(const priority_queue& __q) : c(__q.c), comp(__q.comp) {} 437*4d6fc14bSjoerg 438*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 439*4d6fc14bSjoerg priority_queue& operator=(const priority_queue& __q) 440*4d6fc14bSjoerg {c = __q.c; comp = __q.comp; return *this;} 441*4d6fc14bSjoerg 442*4d6fc14bSjoerg#ifndef _LIBCPP_CXX03_LANG 443*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 444*4d6fc14bSjoerg priority_queue(priority_queue&& __q) 445*4d6fc14bSjoerg _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value && 446*4d6fc14bSjoerg is_nothrow_move_constructible<value_compare>::value) 447*4d6fc14bSjoerg : c(_VSTD::move(__q.c)), comp(_VSTD::move(__q.comp)) {} 448*4d6fc14bSjoerg 449*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 450*4d6fc14bSjoerg priority_queue& operator=(priority_queue&& __q) 451*4d6fc14bSjoerg _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value && 452*4d6fc14bSjoerg is_nothrow_move_assignable<value_compare>::value) 453*4d6fc14bSjoerg {c = _VSTD::move(__q.c); comp = _VSTD::move(__q.comp); return *this;} 454*4d6fc14bSjoerg#endif // _LIBCPP_CXX03_LANG 455*4d6fc14bSjoerg 456*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 457*4d6fc14bSjoerg explicit priority_queue(const value_compare& __comp) 458*4d6fc14bSjoerg : c(), comp(__comp) {} 459*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 460*4d6fc14bSjoerg priority_queue(const value_compare& __comp, const container_type& __c); 461*4d6fc14bSjoerg#ifndef _LIBCPP_CXX03_LANG 462*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 463*4d6fc14bSjoerg priority_queue(const value_compare& __comp, container_type&& __c); 464*4d6fc14bSjoerg#endif 465*4d6fc14bSjoerg template <class _InputIter> 466*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 467*4d6fc14bSjoerg priority_queue(_InputIter __f, _InputIter __l, 468*4d6fc14bSjoerg const value_compare& __comp = value_compare()); 469*4d6fc14bSjoerg template <class _InputIter> 470*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 471*4d6fc14bSjoerg priority_queue(_InputIter __f, _InputIter __l, 472*4d6fc14bSjoerg const value_compare& __comp, const container_type& __c); 473*4d6fc14bSjoerg#ifndef _LIBCPP_CXX03_LANG 474*4d6fc14bSjoerg template <class _InputIter> 475*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 476*4d6fc14bSjoerg priority_queue(_InputIter __f, _InputIter __l, 477*4d6fc14bSjoerg const value_compare& __comp, container_type&& __c); 478*4d6fc14bSjoerg#endif // _LIBCPP_CXX03_LANG 479*4d6fc14bSjoerg template <class _Alloc> 480*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 481*4d6fc14bSjoerg explicit priority_queue(const _Alloc& __a, 482*4d6fc14bSjoerg _EnableIf<uses_allocator<container_type, _Alloc>::value>* = 0); 483*4d6fc14bSjoerg template <class _Alloc> 484*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 485*4d6fc14bSjoerg priority_queue(const value_compare& __comp, const _Alloc& __a, 486*4d6fc14bSjoerg _EnableIf<uses_allocator<container_type, _Alloc>::value>* = 0); 487*4d6fc14bSjoerg template <class _Alloc> 488*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 489*4d6fc14bSjoerg priority_queue(const value_compare& __comp, const container_type& __c, 490*4d6fc14bSjoerg const _Alloc& __a, 491*4d6fc14bSjoerg _EnableIf<uses_allocator<container_type, _Alloc>::value>* = 0); 492*4d6fc14bSjoerg template <class _Alloc> 493*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 494*4d6fc14bSjoerg priority_queue(const priority_queue& __q, const _Alloc& __a, 495*4d6fc14bSjoerg _EnableIf<uses_allocator<container_type, _Alloc>::value>* = 0); 496*4d6fc14bSjoerg#ifndef _LIBCPP_CXX03_LANG 497*4d6fc14bSjoerg template <class _Alloc> 498*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 499*4d6fc14bSjoerg priority_queue(const value_compare& __comp, container_type&& __c, 500*4d6fc14bSjoerg const _Alloc& __a, 501*4d6fc14bSjoerg _EnableIf<uses_allocator<container_type, _Alloc>::value>* = 0); 502*4d6fc14bSjoerg template <class _Alloc> 503*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 504*4d6fc14bSjoerg priority_queue(priority_queue&& __q, const _Alloc& __a, 505*4d6fc14bSjoerg _EnableIf<uses_allocator<container_type, _Alloc>::value>* = 0); 506*4d6fc14bSjoerg#endif // _LIBCPP_CXX03_LANG 507*4d6fc14bSjoerg 508*4d6fc14bSjoerg _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY 509*4d6fc14bSjoerg bool empty() const {return c.empty();} 510*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 511*4d6fc14bSjoerg size_type size() const {return c.size();} 512*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 513*4d6fc14bSjoerg const_reference top() const {return c.front();} 514*4d6fc14bSjoerg 515*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 516*4d6fc14bSjoerg void push(const value_type& __v); 517*4d6fc14bSjoerg#ifndef _LIBCPP_CXX03_LANG 518*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 519*4d6fc14bSjoerg void push(value_type&& __v); 520*4d6fc14bSjoerg template <class... _Args> 521*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 522*4d6fc14bSjoerg void emplace(_Args&&... __args); 523*4d6fc14bSjoerg#endif // _LIBCPP_CXX03_LANG 524*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 525*4d6fc14bSjoerg void pop(); 526*4d6fc14bSjoerg 527*4d6fc14bSjoerg _LIBCPP_INLINE_VISIBILITY 528*4d6fc14bSjoerg void swap(priority_queue& __q) 529*4d6fc14bSjoerg _NOEXCEPT_(__is_nothrow_swappable<container_type>::value && 530*4d6fc14bSjoerg __is_nothrow_swappable<value_compare>::value); 531*4d6fc14bSjoerg}; 532*4d6fc14bSjoerg 533*4d6fc14bSjoerg#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES 534*4d6fc14bSjoergtemplate <class _Compare, 535*4d6fc14bSjoerg class _Container, 536*4d6fc14bSjoerg class = _EnableIf<!__is_allocator<_Compare>::value>, 537*4d6fc14bSjoerg class = _EnableIf<!__is_allocator<_Container>::value> 538*4d6fc14bSjoerg> 539*4d6fc14bSjoergpriority_queue(_Compare, _Container) 540*4d6fc14bSjoerg -> priority_queue<typename _Container::value_type, _Container, _Compare>; 541*4d6fc14bSjoerg 542*4d6fc14bSjoergtemplate<class _InputIterator, 543*4d6fc14bSjoerg class _Compare = less<__iter_value_type<_InputIterator>>, 544*4d6fc14bSjoerg class _Container = vector<__iter_value_type<_InputIterator>>, 545*4d6fc14bSjoerg class = _EnableIf<__is_cpp17_input_iterator<_InputIterator>::value>, 546*4d6fc14bSjoerg class = _EnableIf<!__is_allocator<_Compare>::value>, 547*4d6fc14bSjoerg class = _EnableIf<!__is_allocator<_Container>::value> 548*4d6fc14bSjoerg> 549*4d6fc14bSjoergpriority_queue(_InputIterator, _InputIterator, _Compare = _Compare(), _Container = _Container()) 550*4d6fc14bSjoerg -> priority_queue<__iter_value_type<_InputIterator>, _Container, _Compare>; 551*4d6fc14bSjoerg 552*4d6fc14bSjoergtemplate<class _Compare, 553*4d6fc14bSjoerg class _Container, 554*4d6fc14bSjoerg class _Alloc, 555*4d6fc14bSjoerg class = _EnableIf<!__is_allocator<_Compare>::value>, 556*4d6fc14bSjoerg class = _EnableIf<!__is_allocator<_Container>::value>, 557*4d6fc14bSjoerg class = _EnableIf<__is_allocator<_Alloc>::value> 558*4d6fc14bSjoerg> 559*4d6fc14bSjoergpriority_queue(_Compare, _Container, _Alloc) 560*4d6fc14bSjoerg -> priority_queue<typename _Container::value_type, _Container, _Compare>; 561*4d6fc14bSjoerg#endif 562*4d6fc14bSjoerg 563*4d6fc14bSjoergtemplate <class _Tp, class _Container, class _Compare> 564*4d6fc14bSjoerginline 565*4d6fc14bSjoergpriority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp, 566*4d6fc14bSjoerg const container_type& __c) 567*4d6fc14bSjoerg : c(__c), 568*4d6fc14bSjoerg comp(__comp) 569*4d6fc14bSjoerg{ 570*4d6fc14bSjoerg _VSTD::make_heap(c.begin(), c.end(), comp); 571*4d6fc14bSjoerg} 572*4d6fc14bSjoerg 573*4d6fc14bSjoerg#ifndef _LIBCPP_CXX03_LANG 574*4d6fc14bSjoerg 575*4d6fc14bSjoergtemplate <class _Tp, class _Container, class _Compare> 576*4d6fc14bSjoerginline 577*4d6fc14bSjoergpriority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp, 578*4d6fc14bSjoerg container_type&& __c) 579*4d6fc14bSjoerg : c(_VSTD::move(__c)), 580*4d6fc14bSjoerg comp(__comp) 581*4d6fc14bSjoerg{ 582*4d6fc14bSjoerg _VSTD::make_heap(c.begin(), c.end(), comp); 583*4d6fc14bSjoerg} 584*4d6fc14bSjoerg 585*4d6fc14bSjoerg#endif // _LIBCPP_CXX03_LANG 586*4d6fc14bSjoerg 587*4d6fc14bSjoergtemplate <class _Tp, class _Container, class _Compare> 588*4d6fc14bSjoergtemplate <class _InputIter> 589*4d6fc14bSjoerginline 590*4d6fc14bSjoergpriority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l, 591*4d6fc14bSjoerg const value_compare& __comp) 592*4d6fc14bSjoerg : c(__f, __l), 593*4d6fc14bSjoerg comp(__comp) 594*4d6fc14bSjoerg{ 595*4d6fc14bSjoerg _VSTD::make_heap(c.begin(), c.end(), comp); 596*4d6fc14bSjoerg} 597*4d6fc14bSjoerg 598*4d6fc14bSjoergtemplate <class _Tp, class _Container, class _Compare> 599*4d6fc14bSjoergtemplate <class _InputIter> 600*4d6fc14bSjoerginline 601*4d6fc14bSjoergpriority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l, 602*4d6fc14bSjoerg const value_compare& __comp, 603*4d6fc14bSjoerg const container_type& __c) 604*4d6fc14bSjoerg : c(__c), 605*4d6fc14bSjoerg comp(__comp) 606*4d6fc14bSjoerg{ 607*4d6fc14bSjoerg c.insert(c.end(), __f, __l); 608*4d6fc14bSjoerg _VSTD::make_heap(c.begin(), c.end(), comp); 609*4d6fc14bSjoerg} 610*4d6fc14bSjoerg 611*4d6fc14bSjoerg#ifndef _LIBCPP_CXX03_LANG 612*4d6fc14bSjoerg 613*4d6fc14bSjoergtemplate <class _Tp, class _Container, class _Compare> 614*4d6fc14bSjoergtemplate <class _InputIter> 615*4d6fc14bSjoerginline 616*4d6fc14bSjoergpriority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l, 617*4d6fc14bSjoerg const value_compare& __comp, 618*4d6fc14bSjoerg container_type&& __c) 619*4d6fc14bSjoerg : c(_VSTD::move(__c)), 620*4d6fc14bSjoerg comp(__comp) 621*4d6fc14bSjoerg{ 622*4d6fc14bSjoerg c.insert(c.end(), __f, __l); 623*4d6fc14bSjoerg _VSTD::make_heap(c.begin(), c.end(), comp); 624*4d6fc14bSjoerg} 625*4d6fc14bSjoerg 626*4d6fc14bSjoerg#endif // _LIBCPP_CXX03_LANG 627*4d6fc14bSjoerg 628*4d6fc14bSjoergtemplate <class _Tp, class _Container, class _Compare> 629*4d6fc14bSjoergtemplate <class _Alloc> 630*4d6fc14bSjoerginline 631*4d6fc14bSjoergpriority_queue<_Tp, _Container, _Compare>::priority_queue(const _Alloc& __a, 632*4d6fc14bSjoerg _EnableIf<uses_allocator<container_type, _Alloc>::value>*) 633*4d6fc14bSjoerg : c(__a) 634*4d6fc14bSjoerg{ 635*4d6fc14bSjoerg} 636*4d6fc14bSjoerg 637*4d6fc14bSjoergtemplate <class _Tp, class _Container, class _Compare> 638*4d6fc14bSjoergtemplate <class _Alloc> 639*4d6fc14bSjoerginline 640*4d6fc14bSjoergpriority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp, 641*4d6fc14bSjoerg const _Alloc& __a, 642*4d6fc14bSjoerg _EnableIf<uses_allocator<container_type, _Alloc>::value>*) 643*4d6fc14bSjoerg : c(__a), 644*4d6fc14bSjoerg comp(__comp) 645*4d6fc14bSjoerg{ 646*4d6fc14bSjoerg} 647*4d6fc14bSjoerg 648*4d6fc14bSjoergtemplate <class _Tp, class _Container, class _Compare> 649*4d6fc14bSjoergtemplate <class _Alloc> 650*4d6fc14bSjoerginline 651*4d6fc14bSjoergpriority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp, 652*4d6fc14bSjoerg const container_type& __c, 653*4d6fc14bSjoerg const _Alloc& __a, 654*4d6fc14bSjoerg _EnableIf<uses_allocator<container_type, _Alloc>::value>*) 655*4d6fc14bSjoerg : c(__c, __a), 656*4d6fc14bSjoerg comp(__comp) 657*4d6fc14bSjoerg{ 658*4d6fc14bSjoerg _VSTD::make_heap(c.begin(), c.end(), comp); 659*4d6fc14bSjoerg} 660*4d6fc14bSjoerg 661*4d6fc14bSjoergtemplate <class _Tp, class _Container, class _Compare> 662*4d6fc14bSjoergtemplate <class _Alloc> 663*4d6fc14bSjoerginline 664*4d6fc14bSjoergpriority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue& __q, 665*4d6fc14bSjoerg const _Alloc& __a, 666*4d6fc14bSjoerg _EnableIf<uses_allocator<container_type, _Alloc>::value>*) 667*4d6fc14bSjoerg : c(__q.c, __a), 668*4d6fc14bSjoerg comp(__q.comp) 669*4d6fc14bSjoerg{ 670*4d6fc14bSjoerg _VSTD::make_heap(c.begin(), c.end(), comp); 671*4d6fc14bSjoerg} 672*4d6fc14bSjoerg 673*4d6fc14bSjoerg#ifndef _LIBCPP_CXX03_LANG 674*4d6fc14bSjoerg 675*4d6fc14bSjoergtemplate <class _Tp, class _Container, class _Compare> 676*4d6fc14bSjoergtemplate <class _Alloc> 677*4d6fc14bSjoerginline 678*4d6fc14bSjoergpriority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp, 679*4d6fc14bSjoerg container_type&& __c, 680*4d6fc14bSjoerg const _Alloc& __a, 681*4d6fc14bSjoerg _EnableIf<uses_allocator<container_type, _Alloc>::value>*) 682*4d6fc14bSjoerg : c(_VSTD::move(__c), __a), 683*4d6fc14bSjoerg comp(__comp) 684*4d6fc14bSjoerg{ 685*4d6fc14bSjoerg _VSTD::make_heap(c.begin(), c.end(), comp); 686*4d6fc14bSjoerg} 687*4d6fc14bSjoerg 688*4d6fc14bSjoergtemplate <class _Tp, class _Container, class _Compare> 689*4d6fc14bSjoergtemplate <class _Alloc> 690*4d6fc14bSjoerginline 691*4d6fc14bSjoergpriority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q, 692*4d6fc14bSjoerg const _Alloc& __a, 693*4d6fc14bSjoerg _EnableIf<uses_allocator<container_type, _Alloc>::value>*) 694*4d6fc14bSjoerg : c(_VSTD::move(__q.c), __a), 695*4d6fc14bSjoerg comp(_VSTD::move(__q.comp)) 696*4d6fc14bSjoerg{ 697*4d6fc14bSjoerg _VSTD::make_heap(c.begin(), c.end(), comp); 698*4d6fc14bSjoerg} 699*4d6fc14bSjoerg 700*4d6fc14bSjoerg#endif // _LIBCPP_CXX03_LANG 701*4d6fc14bSjoerg 702*4d6fc14bSjoergtemplate <class _Tp, class _Container, class _Compare> 703*4d6fc14bSjoerginline 704*4d6fc14bSjoergvoid 705*4d6fc14bSjoergpriority_queue<_Tp, _Container, _Compare>::push(const value_type& __v) 706*4d6fc14bSjoerg{ 707*4d6fc14bSjoerg c.push_back(__v); 708*4d6fc14bSjoerg _VSTD::push_heap(c.begin(), c.end(), comp); 709*4d6fc14bSjoerg} 710*4d6fc14bSjoerg 711*4d6fc14bSjoerg#ifndef _LIBCPP_CXX03_LANG 712*4d6fc14bSjoerg 713*4d6fc14bSjoergtemplate <class _Tp, class _Container, class _Compare> 714*4d6fc14bSjoerginline 715*4d6fc14bSjoergvoid 716*4d6fc14bSjoergpriority_queue<_Tp, _Container, _Compare>::push(value_type&& __v) 717*4d6fc14bSjoerg{ 718*4d6fc14bSjoerg c.push_back(_VSTD::move(__v)); 719*4d6fc14bSjoerg _VSTD::push_heap(c.begin(), c.end(), comp); 720*4d6fc14bSjoerg} 721*4d6fc14bSjoerg 722*4d6fc14bSjoergtemplate <class _Tp, class _Container, class _Compare> 723*4d6fc14bSjoergtemplate <class... _Args> 724*4d6fc14bSjoerginline 725*4d6fc14bSjoergvoid 726*4d6fc14bSjoergpriority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args) 727*4d6fc14bSjoerg{ 728*4d6fc14bSjoerg c.emplace_back(_VSTD::forward<_Args>(__args)...); 729*4d6fc14bSjoerg _VSTD::push_heap(c.begin(), c.end(), comp); 730*4d6fc14bSjoerg} 731*4d6fc14bSjoerg 732*4d6fc14bSjoerg#endif // _LIBCPP_CXX03_LANG 733*4d6fc14bSjoerg 734*4d6fc14bSjoergtemplate <class _Tp, class _Container, class _Compare> 735*4d6fc14bSjoerginline 736*4d6fc14bSjoergvoid 737*4d6fc14bSjoergpriority_queue<_Tp, _Container, _Compare>::pop() 738*4d6fc14bSjoerg{ 739*4d6fc14bSjoerg _VSTD::pop_heap(c.begin(), c.end(), comp); 740*4d6fc14bSjoerg c.pop_back(); 741*4d6fc14bSjoerg} 742*4d6fc14bSjoerg 743*4d6fc14bSjoergtemplate <class _Tp, class _Container, class _Compare> 744*4d6fc14bSjoerginline 745*4d6fc14bSjoergvoid 746*4d6fc14bSjoergpriority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q) 747*4d6fc14bSjoerg _NOEXCEPT_(__is_nothrow_swappable<container_type>::value && 748*4d6fc14bSjoerg __is_nothrow_swappable<value_compare>::value) 749*4d6fc14bSjoerg{ 750*4d6fc14bSjoerg using _VSTD::swap; 751*4d6fc14bSjoerg swap(c, __q.c); 752*4d6fc14bSjoerg swap(comp, __q.comp); 753*4d6fc14bSjoerg} 754*4d6fc14bSjoerg 755*4d6fc14bSjoergtemplate <class _Tp, class _Container, class _Compare> 756*4d6fc14bSjoerginline _LIBCPP_INLINE_VISIBILITY 757*4d6fc14bSjoerg_EnableIf< 758*4d6fc14bSjoerg __is_swappable<_Container>::value && __is_swappable<_Compare>::value, 759*4d6fc14bSjoerg void 760*4d6fc14bSjoerg> 761*4d6fc14bSjoergswap(priority_queue<_Tp, _Container, _Compare>& __x, 762*4d6fc14bSjoerg priority_queue<_Tp, _Container, _Compare>& __y) 763*4d6fc14bSjoerg _NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) 764*4d6fc14bSjoerg{ 765*4d6fc14bSjoerg __x.swap(__y); 766*4d6fc14bSjoerg} 767*4d6fc14bSjoerg 768*4d6fc14bSjoergtemplate <class _Tp, class _Container, class _Compare, class _Alloc> 769*4d6fc14bSjoergstruct _LIBCPP_TEMPLATE_VIS uses_allocator<priority_queue<_Tp, _Container, _Compare>, _Alloc> 770*4d6fc14bSjoerg : public uses_allocator<_Container, _Alloc> 771*4d6fc14bSjoerg{ 772*4d6fc14bSjoerg}; 773*4d6fc14bSjoerg 774*4d6fc14bSjoerg_LIBCPP_END_NAMESPACE_STD 775*4d6fc14bSjoerg 776*4d6fc14bSjoerg#endif // _LIBCPP_QUEUE 777