From d02fe67962c8002ddc6e0d6569128ae2645ea7fc Mon Sep 17 00:00:00 2001 From: Douglas Rumbaugh Date: Mon, 24 Jul 2023 16:49:21 -0400 Subject: VPTree: fixed knn query --- include/ds/PriorityQueue.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include/ds/PriorityQueue.h') 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 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 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 > 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> data; CMP cmp; size_t tail; + R *baseline; /* * Swap the elements at position a and position -- cgit v1.2.3