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 _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 _Myt &_Right)
 
 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)
 
_Mytoperator= (const _Myt &_Right)
 
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 (_Myt &&_Right) _NOEXCEPT_OP(is_nothrow_move_constructible< _Container >
 
 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)
 
_Mytoperator= (_Myt &&_Right) _NOEXCEPT_OP(is_nothrow_move_assignable< _Container >
 
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 _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
250  : c(), comp()
251  { // construct with empty container, default comparator
252  }
_Container c
Definition: queue:426
_Pr comp
Definition: queue:427
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
priority_queue< _Ty, _Container, _Pr >::priority_queue ( const _Myt _Right)
inline
255  : c(_Right.c), comp(_Right.comp)
256  { // construct by copying _Right
257  }
_Container c
Definition: queue:426
_Pr comp
Definition: queue:427
constexpr const _Ty &() _Right
Definition: algorithm:3591
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
260  : c(), comp(_Pred)
261  { // construct with empty container, specified comparator
262  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:426
_Pr comp
Definition: queue:427
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
265  : c(_Cont), comp(_Pred)
266  { // construct by copying specified container, comparator
267  make_heap(c.begin(), c.end(), comp);
268  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:426
_Pr comp
Definition: queue:427
void make_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2124
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
272  : c(_First, _Last), comp()
273  { // construct by copying [_First, _Last), default comparator
274  make_heap(c.begin(), c.end(), comp);
275  }
_Container c
Definition: queue:426
_Pr comp
Definition: queue:427
void make_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2124
_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
279  : c(_First, _Last), comp(_Pred)
280  { // construct by copying [_First, _Last), specified comparator
281  make_heap(c.begin(), c.end(), comp);
282  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:426
_Pr comp
Definition: queue:427
void make_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2124
_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
287  : c(_Cont), comp(_Pred)
288  { // construct by copying [_First, _Last), container, and comparator
289  c.insert(c.end(), _First, _Last);
290  make_heap(c.begin(), c.end(), comp);
291  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:426
_Pr comp
Definition: queue:427
void make_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2124
_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
305  : c(_Al)
306  { // construct with empty container, allocator
307  }
_Container c
Definition: queue:426
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
313  : c(_Al), comp(_Pred)
314  { // construct with empty container, comparator, allocator
315  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:426
_Pr comp
Definition: queue:427
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
322  : c(_Cont, _Al), comp(_Pred)
323  { // construct by copying specified container, comparator, allocator
324  make_heap(c.begin(), c.end(), comp);
325  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:426
_Pr comp
Definition: queue:427
void make_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2124
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
331  : c(_Right.c, _Al), comp(_Right.comp)
332  { // construct by copying _Right, allocator
333  }
_Container c
Definition: queue:426
_Pr comp
Definition: queue:427
constexpr const _Ty &() _Right
Definition: algorithm:3591
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
priority_queue< _Ty, _Container, _Pr >::priority_queue ( _Myt &&  _Right)
inline
338  : c(_STD move(_Right.c)), comp(_STD move(_Right.comp))
339  { // construct by moving _Right
340  }
_Container c
Definition: queue:426
_Pr comp
Definition: queue:427
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1290
constexpr const _Ty &() _Right
Definition: algorithm:3591
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
343  : c(_STD move(_Cont)), comp(_Pred)
344  { // construct by moving specified container, comparator
345  make_heap(c.begin(), c.end(), comp);
346  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:426
_Pr comp
Definition: queue:427
void make_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2124
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1290
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
351  : c(_STD move(_Cont)), comp(_Pred)
352  { // construct by copying [_First, _Last), moving container
353  c.insert(c.end(), _First, _Last);
354  make_heap(c.begin(), c.end(), comp);
355  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:426
_Pr comp
Definition: queue:427
void make_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2124
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1290
_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
362  : c(_STD move(_Cont), _Al), comp(_Pred)
363  { // construct by moving specified container, comparator, allocator
364  make_heap(c.begin(), c.end(), comp);
365  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:426
_Pr comp
Definition: queue:427
void make_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2124
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1290
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
371  : c(_STD move(_Right.c), _Al), comp(_STD move(_Right.comp))
372  { // construct by moving _Right, allocator
373  }
_Container c
Definition: queue:426
_Pr comp
Definition: queue:427
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1290
constexpr const _Ty &() _Right
Definition: algorithm:3591

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
392  { // insert element at beginning
393  c.emplace_back(_STD forward<_Valty>(_Val)...);
394  push_heap(c.begin(), c.end(), comp);
395  }
_Container c
Definition: queue:426
_In_ int _Val
Definition: vcruntime_string.h:62
_Pr comp
Definition: queue:427
void push_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2016
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
bool priority_queue< _Ty, _Container, _Pr >::empty ( ) const
inline
399  { // test if queue is empty
400  return (c.empty());
401  }
_Container c
Definition: queue:426
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
_Myt& priority_queue< _Ty, _Container, _Pr >::operator= ( const _Myt _Right)
inline
294  { // assign by copying _Right
295  c = _Right.c;
296  comp = _Right.comp;
297  return (*this);
298  }
_Container c
Definition: queue:426
_Pr comp
Definition: queue:427
constexpr const _Ty &() _Right
Definition: algorithm:3591
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
_Myt& priority_queue< _Ty, _Container, _Pr >::operator= ( _Myt &&  _Right)
inline
378  { // assign by moving _Right
379  c = _STD move(_Right.c);
380  comp = _STD move(_Right.comp);
381  return (*this);
382  }
_Container c
Definition: queue:426
_Pr comp
Definition: queue:427
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1290
constexpr const _Ty &() _Right
Definition: algorithm:3591
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
void priority_queue< _Ty, _Container, _Pr >::pop ( )
inline
420  { // erase highest-priority element
421  pop_heap(c.begin(), c.end(), comp);
422  c.pop_back();
423  }
_Container c
Definition: queue:426
_Pr comp
Definition: queue:427
void pop_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2090
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
385  { // insert element at beginning
386  c.push_back(_STD move(_Val));
387  push_heap(c.begin(), c.end(), comp);
388  }
_Container c
Definition: queue:426
_In_ int _Val
Definition: vcruntime_string.h:62
_Pr comp
Definition: queue:427
void push_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2016
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1290
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
414  { // insert value in priority order
415  c.push_back(_Val);
416  push_heap(c.begin(), c.end(), comp);
417  }
_Container c
Definition: queue:426
_In_ int _Val
Definition: vcruntime_string.h:62
_Pr comp
Definition: queue:427
void push_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2016
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
size_type priority_queue< _Ty, _Container, _Pr >::size ( ) const
inline
404  { // return length of queue
405  return (c.size());
406  }
_Container c
Definition: queue:426
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
void priority_queue< _Ty, _Container, _Pr >::swap ( _Myt _Right)
inline
433  { // exchange contents with _Right
434  _Swap_adl(c, _Right.c);
435  _Swap_adl(comp, _Right.comp);
436  }
_Container c
Definition: queue:426
_Pr comp
Definition: queue:427
void _Swap_adl(_Ty &_Left, _Ty &_Right) _NOEXCEPT_OP(_Is_nothrow_swappable< _Ty >
Definition: utility:56
constexpr const _Ty &() _Right
Definition: algorithm:3591
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
const_reference priority_queue< _Ty, _Container, _Pr >::top ( ) const
inline
409  { // return highest-priority element
410  return (c.front());
411  }
_Container c
Definition: queue:426

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: