22 #ifndef ULTIMA8_MISC_PRIORITY_QUEUE_H 23 #define ULTIMA8_MISC_PRIORITY_QUEUE_H 25 #include "common/algorithm.h" 26 #include "common/util.h" 36 template <
class _Ty,
class _Container,
class _Pr>
41 explicit PriorityQueue(
const _Pr &_Pred) : c(), comp(_Pred) {}
43 PriorityQueue(
const _Pr &_Pred,
const _Container &_Cont) : c(_Cont), comp(_Pred) {
44 make_heap(c.begin(), c.end(), comp);
47 template <
class _InIt>
48 PriorityQueue(_InIt _First, _InIt _Last,
const _Pr &_Pred,
const _Container &_Cont) : c(_Cont), comp(_Pred) {
49 c.insert(c.end(), _First, _Last);
50 make_heap(c.begin(), c.end(), comp);
53 template <
class _InIt>
54 PriorityQueue(_InIt _First, _InIt _Last) : c(_First, _Last), comp() {
55 make_heap(c.begin(), c.end(), comp);
58 template <
class _InIt>
59 PriorityQueue(_InIt _First, _InIt _Last,
const _Pr &_Pred) : c(_First, _Last), comp(_Pred) {
60 make_heap(c.begin(), c.end(), comp);
71 typename _Container::const_reference top()
const {
75 void push(
const typename _Container::value_type &_Val) {
84 void swap(PriorityQueue &_Right) {
86 SWAP(comp, _Right.comp);
Definition: priority_queue.h:37
void SWAP(T &a, T &b)
Definition: util.h:84
Definition: detection.h:27
void sort(T first, T last, StrictWeakOrdering comp)
Definition: algorithm.h:349