summaryrefslogtreecommitdiffstats
path: root/include/ds/PriorityQueue.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/ds/PriorityQueue.h')
-rw-r--r--include/ds/PriorityQueue.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/ds/PriorityQueue.h b/include/ds/PriorityQueue.h
index a8e9ba5..4612eef 100644
--- a/include/ds/PriorityQueue.h
+++ b/include/ds/PriorityQueue.h
@@ -23,6 +23,7 @@ struct queue_record {
template <typename R>
class standard_minheap {
public:
+ standard_minheap(R *baseline) {}
inline bool operator()(const R* a, const R* b) {
return *a < *b;
}
@@ -31,6 +32,7 @@ public:
template <typename R>
class standard_maxheap {
public:
+ standard_maxheap(R *baseline) {}
inline bool operator()(const R* a, const R* b) {
return *a > *b;
}
@@ -39,7 +41,8 @@ public:
template <typename R, typename CMP=standard_minheap<R>>
class PriorityQueue {
public:
- PriorityQueue(size_t size) : data(size), tail(0) {}
+ PriorityQueue(size_t size, R* cmp_baseline=nullptr) : data(size), tail(0), cmp(cmp_baseline) {}
+
~PriorityQueue() = default;
size_t size() const {
@@ -97,6 +100,7 @@ private:
std::vector<queue_record<R>> data;
CMP cmp;
size_t tail;
+ R *baseline;
/*
* Swap the elements at position a and position