18#ifndef INCLUDED_PRIORITYQUEUE
19#define INCLUDED_PRIORITYQUEUE
33#define PRIORITYQUEUE_DEBUG 0
35#define PRIORITYQUEUE_DEBUG 1
38template <
typename Item,
typename CMP>
43 if (
CMP()(b.rank, a.rank))
45 if (
CMP()(a.rank, b.rank))
56#if PRIORITYQUEUE_DEBUG
69template <
typename ID,
typename R,
typename H,
typename CMP = std::less<R> >
86 void promote(ID
id, R , R newrank, H newh)
93#if PRIORITYQUEUE_DEBUG
106#if PRIORITYQUEUE_DEBUG
140template <
typename ID,
typename R,
typename H,
typename CMP = std::less<R> >
158 for (
size_t n = 0; n <
m_List.size(); ++n)
174#if PRIORITYQUEUE_DEBUG
180 size_t bestidx =
m_List.size()-1;
Priority queue implemented as a binary heap.
Definition: PriorityQueue.h:71
Item pop()
Definition: PriorityQueue.h:104
std::vector< Item > m_Heap
Definition: PriorityQueue.h:130
bool empty()
Definition: PriorityQueue.h:115
size_t size()
Definition: PriorityQueue.h:120
void promote(ID id, R, R newrank, H newh)
Definition: PriorityQueue.h:86
void clear()
Definition: PriorityQueue.h:125
void push(const Item &item)
Definition: PriorityQueue.h:80
Priority queue implemented as an unsorted array.
Definition: PriorityQueue.h:142
void promote(ID id, R, R newrank, H newh)
Definition: PriorityQueue.h:166
bool empty()
Definition: PriorityQueue.h:195
size_t size()
Definition: PriorityQueue.h:200
Item pop()
Definition: PriorityQueue.h:172
Item * find(ID id)
Definition: PriorityQueue.h:156
std::vector< Item > m_List
Definition: PriorityQueue.h:211
void push(const Item &item)
Definition: PriorityQueue.h:151
void clear()
Definition: PriorityQueue.h:206
#define debug_warn(expr)
display the error dialog with the given text.
Definition: debug.h:264
#define ENSURE(expr)
ensure the expression <expr> evaluates to non-zero.
Definition: debug.h:222
Definition: PriorityQueue.h:74
R rank
Definition: PriorityQueue.h:76
ID id
Definition: PriorityQueue.h:75
H h
Definition: PriorityQueue.h:77
Definition: PriorityQueue.h:145
R rank
Definition: PriorityQueue.h:147
H h
Definition: PriorityQueue.h:148
ID id
Definition: PriorityQueue.h:146
Definition: PriorityQueue.h:40
bool operator()(const Item &a, const Item &b) const
Definition: PriorityQueue.h:41
intptr_t ssize_t
Definition: wposix_types.h:36