STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Public Attributes | 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
 
reference top ()
 
void push (const value_type &_Val)
 
void pop ()
 
void swap (_Myt &_Right)&&_NOEXCEPT_OP(_Swap_adl(comp
 
 _Swap_adl (comp, _Right.comp)
 

Public Attributes

void _Right comp
 

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
248  : c(), comp()
249  { // construct with empty container, default comparator
250  }
_Container c
Definition: queue:437
void _Right comp
Definition: queue:431
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
253  : c(_Right.c), comp(_Right.comp)
254  { // construct by copying _Right
255  }
_Container c
Definition: queue:437
void _Right comp
Definition: queue:431
const _Ty & _Right
Definition: algorithm:4087
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
258  : c(), comp(_Pred)
259  { // construct with empty container, specified comparator
260  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:437
void _Right comp
Definition: queue:431
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
263  : c(_Cont), comp(_Pred)
264  { // construct by copying specified container, comparator
265  make_heap(c.begin(), c.end(), comp);
266  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:437
void _Right comp
Definition: queue:431
void make_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2455
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
270  : c(_First, _Last), comp()
271  { // construct by copying [_First, _Last), default comparator
272  make_heap(c.begin(), c.end(), comp);
273  }
_Container c
Definition: queue:437
void _Right comp
Definition: queue:431
void make_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2455
_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
277  : c(_First, _Last), comp(_Pred)
278  { // construct by copying [_First, _Last), specified comparator
279  make_heap(c.begin(), c.end(), comp);
280  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:437
void _Right comp
Definition: queue:431
void make_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2455
_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
285  : c(_Cont), comp(_Pred)
286  { // construct by copying [_First, _Last), container, and comparator
287  c.insert(c.end(), _First, _Last);
288  make_heap(c.begin(), c.end(), comp);
289  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:437
void _Right comp
Definition: queue:431
void make_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2455
_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
303  : c(_Al)
304  { // construct with empty container, allocator
305  }
_Container c
Definition: queue:437
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
311  : c(_Al), comp(_Pred)
312  { // construct with empty container, comparator, allocator
313  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:437
void _Right comp
Definition: queue:431
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
320  : c(_Cont, _Al), comp(_Pred)
321  { // construct by copying specified container, comparator, allocator
322  make_heap(c.begin(), c.end(), comp);
323  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:437
void _Right comp
Definition: queue:431
void make_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2455
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
329  : c(_Right.c, _Al), comp(_Right.comp)
330  { // construct by copying _Right, allocator
331  }
_Container c
Definition: queue:437
void _Right comp
Definition: queue:431
const _Ty & _Right
Definition: algorithm:4087
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
priority_queue< _Ty, _Container, _Pr >::priority_queue ( _Myt &&  _Right)
inline
336  : c(_STD move(_Right.c)), comp(_STD move(_Right.comp))
337  { // construct by moving _Right
338  }
_Container c
Definition: queue:437
_OutIt move(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2447
void _Right comp
Definition: queue:431
const _Ty & _Right
Definition: algorithm:4087
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
341  : c(_STD move(_Cont)), comp(_Pred)
342  { // construct by moving specified container, comparator
343  make_heap(c.begin(), c.end(), comp);
344  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:437
_OutIt move(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2447
void _Right comp
Definition: queue:431
void make_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2455
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
349  : c(_STD move(_Cont)), comp(_Pred)
350  { // construct by copying [_First, _Last), moving container
351  c.insert(c.end(), _First, _Last);
352  make_heap(c.begin(), c.end(), comp);
353  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:437
_OutIt move(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2447
void _Right comp
Definition: queue:431
void make_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2455
_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
360  : c(_STD move(_Cont), _Al), comp(_Pred)
361  { // construct by moving specified container, comparator, allocator
362  make_heap(c.begin(), c.end(), comp);
363  }
_FwdIt const _Ty _Pr _Pred
Definition: algorithm:1985
_Container c
Definition: queue:437
_OutIt move(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2447
void _Right comp
Definition: queue:431
void make_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2455
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
369  : c(_STD move(_Right.c), _Al), comp(_STD move(_Right.comp))
370  { // construct by moving _Right, allocator
371  }
_Container c
Definition: queue:437
_OutIt move(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2447
void _Right comp
Definition: queue:431
const _Ty & _Right
Definition: algorithm:4087

Member Function Documentation

template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
priority_queue< _Ty, _Container, _Pr >::_Swap_adl ( comp  ,
_Right.  comp 
)
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
390  { // insert element at beginning
391  c.emplace_back(_STD forward<_Valty>(_Val)...);
392  push_heap(c.begin(), c.end(), comp);
393  }
_Container c
Definition: queue:437
void _Right comp
Definition: queue:431
void push_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2341
_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
397  { // test if queue is empty
398  return (c.empty());
399  }
_Container c
Definition: queue:437
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
292  { // assign by copying _Right
293  c = _Right.c;
294  comp = _Right.comp;
295  return (*this);
296  }
_Container c
Definition: queue:437
void _Right comp
Definition: queue:431
const _Ty & _Right
Definition: algorithm:4087
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
_Myt& priority_queue< _Ty, _Container, _Pr >::operator= ( _Myt &&  _Right)
inline
376  { // assign by moving _Right
377  c = _STD move(_Right.c);
378  comp = _STD move(_Right.comp);
379  return (*this);
380  }
_Container c
Definition: queue:437
_OutIt move(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2447
void _Right comp
Definition: queue:431
const _Ty & _Right
Definition: algorithm:4087
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
void priority_queue< _Ty, _Container, _Pr >::pop ( )
inline
423  { // erase highest-priority element
424  pop_heap(c.begin(), c.end(), comp);
425  c.pop_back();
426  }
_Container c
Definition: queue:437
void _Right comp
Definition: queue:431
void pop_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2420
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
383  { // insert element at beginning
384  c.push_back(_STD move(_Val));
385  push_heap(c.begin(), c.end(), comp);
386  }
_Container c
Definition: queue:437
_OutIt move(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2447
void _Right comp
Definition: queue:431
void push_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2341
_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
417  { // insert value in priority order
418  c.push_back(_Val);
419  push_heap(c.begin(), c.end(), comp);
420  }
_Container c
Definition: queue:437
void _Right comp
Definition: queue:431
void push_heap(_RanIt _First, _RanIt _Last, _Pr _Pred)
Definition: algorithm:2341
_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
402  { // return length of queue
403  return (c.size());
404  }
_Container c
Definition: queue:437
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
void priority_queue< _Ty, _Container, _Pr >::swap ( _Myt _Right)
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
const_reference priority_queue< _Ty, _Container, _Pr >::top ( ) const
inline
407  { // return highest-priority element
408  return (c.front());
409  }
_Container c
Definition: queue:437
template<class _Ty, class _Container = vector<_Ty>, class _Pr = less<typename _Container::value_type>>
reference priority_queue< _Ty, _Container, _Pr >::top ( )
inline
412  { // return mutable highest-priority element (retained)
413  return (c.front());
414  }
_Container c
Definition: queue:437

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>>
void _Right priority_queue< _Ty, _Container, _Pr >::comp
Initial value:
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: