diff options
| author | Douglas Rumbaugh <dbr4@psu.edu> | 2023-07-24 16:49:21 -0400 |
|---|---|---|
| committer | Douglas Rumbaugh <dbr4@psu.edu> | 2023-07-24 16:49:21 -0400 |
| commit | d02fe67962c8002ddc6e0d6569128ae2645ea7fc (patch) | |
| tree | b0b27a29c58c65d51984318433f58698f297700e /include/ds/PriorityQueue.h | |
| parent | ac018f5f96c32c96158a239fbfeb9dc439c95548 (diff) | |
| download | dynamic-extension-d02fe67962c8002ddc6e0d6569128ae2645ea7fc.tar.gz | |
VPTree: fixed knn query
Diffstat (limited to 'include/ds/PriorityQueue.h')
| -rw-r--r-- | include/ds/PriorityQueue.h | 6 |
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 |