STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Protected Attributes | List of all members
priority_queue< _Ty, _Container, _Pr > Class Template Reference

Public Types

typedef priority_queue< _Ty, _Container, _Pr > _Myt
 
typedef _Container container_type
 
typedef _Pr value_compare
 
typedef _Container::value_type value_type
 
typedef _Container::size_type size_type
 
typedef _Container::reference reference
 
typedef _Container::const_reference const_reference
 

Public Member Functions

 priority_queue ()
 
 priority_queue (const _Pr &_Pred)
 
 priority_queue (const _Pr &_Pred, const _Container &_Cont)
 
template<class _InIt >
 priority_queue (_InIt _First, _InIt _Last)
 
template<class _InIt >
 priority_queue (_InIt _First, _InIt _Last, const _Pr &_Pred)
 
template<class _InIt >
 priority_queue (_InIt _First, _InIt _Last, const _Pr &_Pred, const _Container &_Cont)
 
template<class _Alloc , class = typename enable_if<uses_allocator<_Container, _Alloc>::value, void>::type>
 priority_queue (const _Alloc &_Al)
 
template<class _Alloc , class = typename enable_if<uses_allocator<_Container, _Alloc>::value, void>::type>
 priority_queue (const _Pr &_Pred, const _Alloc &_Al)
 
template<class _Alloc , class = typename enable_if<uses_allocator<_Container, _Alloc>::value, void>::type>
 priority_queue (const _Pr &_Pred, const _Container &_Cont, const _Alloc &_Al)
 
template<class _Alloc , class = typename enable_if<uses_allocator<_Container, _Alloc>::value, void>::type>
 priority_queue (const _Myt &_Right, const _Alloc &_Al)
 
 priority_queue (const _Pr &_Pred, _Container &&_Cont)
 
template<class _InIt >
 priority_queue (_InIt _First, _InIt _Last, const _Pr &_Pred, _Container &&_Cont)
 
template<class _Alloc , class = typename enable_if<uses_allocator<_Container, _Alloc>::value, void>::type>
 priority_queue (const _Pr &_Pred, _Container &&_Cont, const _Alloc &_Al)
 
template<class _Alloc , class = typename enable_if<uses_allocator<_Container, _Alloc>::value, void>::type>
 priority_queue (_Myt &&_Right, const _Alloc &_Al)
 
void push (value_type &&_Val)
 
template<class... _Valty>
void emplace (_Valty &&..._Val)
 
bool empty () const
 
size_type size () const
 
const_reference top () const
 
void push (const value_type &_Val)
 
void pop ()
 
void swap (_Myt &_Right) _NOEXCEPT_OP(_Is_nothrow_swappable< _Container >
 

Protected Attributes

_Container c
 
_Pr comp
 

Member Typedef Documentation

template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
typedef priority_queue<_Ty, _Container, _Pr> priority_queue< _Ty, _Container, _Pr >::_Myt
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
typedef _Container::const_reference priority_queue< _Ty, _Container, _Pr >::const_reference
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
typedef _Container priority_queue< _Ty, _Container, _Pr >::container_type
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
typedef _Container::reference priority_queue< _Ty, _Container, _Pr >::reference
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
typedef _Container::size_type priority_queue< _Ty, _Container, _Pr >::size_type
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
typedef _Pr priority_queue< _Ty, _Container, _Pr >::value_compare
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
typedef _Container::value_type priority_queue< _Ty, _Container, _Pr >::value_type

Constructor & Destructor Documentation

template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
priority_queue< _Ty, _Container, _Pr >::priority_queue ( )
inline
229  : c(), comp()
230  { // construct with empty container, default comparator
231  }
_Container c
Definition: queue:383
_Pr comp
Definition: queue:384
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
priority_queue< _Ty, _Container, _Pr >::priority_queue ( const _Pr &  _Pred)
inlineexplicit
234  : c(), comp(_Pred)
235  { // construct with empty container, specified comparator
236  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:383
_Pr comp
Definition: queue:384
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
priority_queue< _Ty, _Container, _Pr >::priority_queue ( const _Pr &  _Pred,
const _Container &  _Cont 
)
inline
239  : c(_Cont), comp(_Pred)
240  { // construct by copying specified container, comparator
241  make_heap(c.begin(), c.end(), comp);
242  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:383
_Pr comp
Definition: queue:384
void make_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2256
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
template<class _InIt >
priority_queue< _Ty, _Container, _Pr >::priority_queue ( _InIt  _First,
_InIt  _Last 
)
inline
246  : c(_First, _Last), comp()
247  { // construct by copying [_First, _Last), default comparator
248  make_heap(c.begin(), c.end(), comp);
249  }
_Container c
Definition: queue:383
_Pr comp
Definition: queue:384
void make_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2256
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
template<class _InIt >
priority_queue< _Ty, _Container, _Pr >::priority_queue ( _InIt  _First,
_InIt  _Last,
const _Pr &  _Pred 
)
inline
253  : c(_First, _Last), comp(_Pred)
254  { // construct by copying [_First, _Last), specified comparator
255  make_heap(c.begin(), c.end(), comp);
256  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:383
_Pr comp
Definition: queue:384
void make_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2256
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
template<class _InIt >
priority_queue< _Ty, _Container, _Pr >::priority_queue ( _InIt  _First,
_InIt  _Last,
const _Pr &  _Pred,
const _Container &  _Cont 
)
inline
261  : c(_Cont), comp(_Pred)
262  { // construct by copying [_First, _Last), container, and comparator
263  c.insert(c.end(), _First, _Last);
264  make_heap(c.begin(), c.end(), comp);
265  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:383
_Pr comp
Definition: queue:384
void make_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2256
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
template<class _Alloc , class = typename enable_if<uses_allocator<_Container, _Alloc>::value, void>::type>
priority_queue< _Ty, _Container, _Pr >::priority_queue ( const _Alloc &  _Al)
inlineexplicit
271  : c(_Al)
272  { // construct with empty container, allocator
273  }
_Container c
Definition: queue:383
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
template<class _Alloc , class = typename enable_if<uses_allocator<_Container, _Alloc>::value, void>::type>
priority_queue< _Ty, _Container, _Pr >::priority_queue ( const _Pr &  _Pred,
const _Alloc &  _Al 
)
inline
279  : c(_Al), comp(_Pred)
280  { // construct with empty container, comparator, allocator
281  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:383
_Pr comp
Definition: queue:384
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
template<class _Alloc , class = typename enable_if<uses_allocator<_Container, _Alloc>::value, void>::type>
priority_queue< _Ty, _Container, _Pr >::priority_queue ( const _Pr &  _Pred,
const _Container &  _Cont,
const _Alloc &  _Al 
)
inline
288  : c(_Cont, _Al), comp(_Pred)
289  { // construct by copying specified container, comparator, allocator
290  make_heap(c.begin(), c.end(), comp);
291  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:383
_Pr comp
Definition: queue:384
void make_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2256
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
template<class _Alloc , class = typename enable_if<uses_allocator<_Container, _Alloc>::value, void>::type>
priority_queue< _Ty, _Container, _Pr >::priority_queue ( const _Myt _Right,
const _Alloc &  _Al 
)
inline
297  : c(_Right.c, _Al), comp(_Right.comp)
298  { // construct by copying _Right, allocator
299  }
_Container c
Definition: queue:383
_Pr comp
Definition: queue:384
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
priority_queue< _Ty, _Container, _Pr >::priority_queue ( const _Pr &  _Pred,
_Container &&  _Cont 
)
inline
302  : c(_STD move(_Cont)), comp(_Pred)
303  { // construct by moving specified container, comparator
304  make_heap(c.begin(), c.end(), comp);
305  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:383
_Pr comp
Definition: queue:384
void make_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2256
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1349
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
template<class _InIt >
priority_queue< _Ty, _Container, _Pr >::priority_queue ( _InIt  _First,
_InIt  _Last,
const _Pr &  _Pred,
_Container &&  _Cont 
)
inline
310  : c(_STD move(_Cont)), comp(_Pred)
311  { // construct by copying [_First, _Last), moving container
312  c.insert(c.end(), _First, _Last);
313  make_heap(c.begin(), c.end(), comp);
314  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:383
_Pr comp
Definition: queue:384
void make_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2256
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1349
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
template<class _Alloc , class = typename enable_if<uses_allocator<_Container, _Alloc>::value, void>::type>
priority_queue< _Ty, _Container, _Pr >::priority_queue ( const _Pr &  _Pred,
_Container &&  _Cont,
const _Alloc &  _Al 
)
inline
321  : c(_STD move(_Cont), _Al), comp(_Pred)
322  { // construct by moving specified container, comparator, allocator
323  make_heap(c.begin(), c.end(), comp);
324  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:383
_Pr comp
Definition: queue:384
void make_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2256
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1349
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
template<class _Alloc , class = typename enable_if<uses_allocator<_Container, _Alloc>::value, void>::type>
priority_queue< _Ty, _Container, _Pr >::priority_queue ( _Myt &&  _Right,
const _Alloc &  _Al 
)
inline
330  : c(_STD move(_Right.c), _Al), comp(_STD move(_Right.comp))
331  { // construct by moving _Right, allocator
332  }
_Container c
Definition: queue:383
_Pr comp
Definition: queue:384
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1349
constexpr const _Ty &() _Right
Definition: algorithm:3723

Member Function Documentation

template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
template<class... _Valty>
void priority_queue< _Ty, _Container, _Pr >::emplace ( _Valty &&...  _Val)
inline
342  { // insert element at beginning
343  c.emplace_back(_STD forward<_Valty>(_Val)...);
344  push_heap(c.begin(), c.end(), comp);
345  }
_Container c
Definition: queue:383
_Pr comp
Definition: queue:384
void push_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2148
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
bool priority_queue< _Ty, _Container, _Pr >::empty ( ) const
inline
348  { // test if queue is empty
349  return (c.empty());
350  }
_Container c
Definition: queue:383
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
void priority_queue< _Ty, _Container, _Pr >::pop ( )
inline
369  { // erase highest-priority element
370  pop_heap(c.begin(), c.end(), comp);
371  c.pop_back();
372  }
_Container c
Definition: queue:383
_Pr comp
Definition: queue:384
void pop_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2222
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
void priority_queue< _Ty, _Container, _Pr >::push ( value_type &&  _Val)
inline
335  { // insert element at beginning
336  c.push_back(_STD move(_Val));
337  push_heap(c.begin(), c.end(), comp);
338  }
_Container c
Definition: queue:383
_Pr comp
Definition: queue:384
void push_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2148
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1349
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
void priority_queue< _Ty, _Container, _Pr >::push ( const value_type _Val)
inline
363  { // insert value in priority order
364  c.push_back(_Val);
365  push_heap(c.begin(), c.end(), comp);
366  }
_Container c
Definition: queue:383
_Pr comp
Definition: queue:384
void push_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2148
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
size_type priority_queue< _Ty, _Container, _Pr >::size ( ) const
inline
353  { // return length of queue
354  return (c.size());
355  }
_Container c
Definition: queue:383
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
void priority_queue< _Ty, _Container, _Pr >::swap ( _Myt _Right)
inline
377  { // exchange contents with _Right
378  _Swap_adl(c, _Right.c);
379  _Swap_adl(comp, _Right.comp);
380  }
_Container c
Definition: queue:383
_Pr comp
Definition: queue:384
void _Swap_adl(_Ty &_Left, _Ty &_Right) _NOEXCEPT_OP(_Is_nothrow_swappable< _Ty >
Definition: utility:73
constexpr const _Ty &() _Right
Definition: algorithm:3723
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
const_reference priority_queue< _Ty, _Container, _Pr >::top ( ) const
inline
358  { // return highest-priority element
359  return (c.front());
360  }
_Container c
Definition: queue:383

Member Data Documentation

template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
_Container priority_queue< _Ty, _Container, _Pr >::c
protected
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
_Pr priority_queue< _Ty, _Container, _Pr >::comp
protected

The documentation for this class was generated from the following file: