18#ifndef INCLUDED_PRIORITYQUEUE
19#define INCLUDED_PRIORITYQUEUE
27#define PRIORITYQUEUE_DEBUG 0
29#define PRIORITYQUEUE_DEBUG 1
32template <
typename Item,
typename CMP>
37 if (
CMP()(b.rank, a.rank))
39 if (
CMP()(a.rank, b.rank))
50#if PRIORITYQUEUE_DEBUG
63template <
typename ID,
typename R,
typename H,
typename CMP = std::less<R> >
87#if PRIORITYQUEUE_DEBUG
100#if PRIORITYQUEUE_DEBUG
134template <
typename ID,
typename R,
typename H,
typename CMP = std::less<R> >
152 for (
size_t n = 0; n <
m_List.size(); ++n)
168#if PRIORITYQUEUE_DEBUG
174 size_t bestidx =
m_List.size()-1;
Priority queue implemented as a binary heap.
Definition: PriorityQueue.h:65
Item pop()
Definition: PriorityQueue.h:98
std::vector< Item > m_Heap
Definition: PriorityQueue.h:124
bool empty()
Definition: PriorityQueue.h:109
size_t size()
Definition: PriorityQueue.h:114
void promote(ID id, R oldrank, R newrank, H newh)
Definition: PriorityQueue.h:80
void clear()
Definition: PriorityQueue.h:119
void push(const Item &item)
Definition: PriorityQueue.h:74
Priority queue implemented as an unsorted array.
Definition: PriorityQueue.h:136
bool empty()
Definition: PriorityQueue.h:189
size_t size()
Definition: PriorityQueue.h:194
Item pop()
Definition: PriorityQueue.h:166
Item * find(ID id)
Definition: PriorityQueue.h:150
std::vector< Item > m_List
Definition: PriorityQueue.h:205
void push(const Item &item)
Definition: PriorityQueue.h:145
void clear()
Definition: PriorityQueue.h:200
void promote(ID id, R oldrank, R newrank, H newh)
Definition: PriorityQueue.h:160
#define UNUSED(param)
mark a function parameter as unused and avoid the corresponding compiler warning.
Definition: code_annotation.h:40
#define debug_warn(expr)
display the error dialog with the given text.
Definition: debug.h:319
#define ENSURE(expr)
ensure the expression <expr> evaluates to non-zero.
Definition: debug.h:277
Definition: PriorityQueue.h:68
R rank
Definition: PriorityQueue.h:70
ID id
Definition: PriorityQueue.h:69
H h
Definition: PriorityQueue.h:71
Definition: PriorityQueue.h:139
R rank
Definition: PriorityQueue.h:141
H h
Definition: PriorityQueue.h:142
ID id
Definition: PriorityQueue.h:140
Definition: PriorityQueue.h:34
bool operator()(const Item &a, const Item &b) const
Definition: PriorityQueue.h:35
intptr_t ssize_t
Definition: wposix_types.h:82