summaryrefslogtreecommitdiffstats
path: root/include/ds
diff options
context:
space:
mode:
authorDouglas Rumbaugh <dbr4@psu.edu>2023-05-15 16:48:56 -0400
committerDouglas Rumbaugh <dbr4@psu.edu>2023-05-15 16:48:56 -0400
commitff000799c3254f52e0beabbe9c62d10c3fc4178e (patch)
tree49a1a045678315e8e215fd80409973679b793043 /include/ds
parent418e9b079e559c86f3a5b276f712ad2f5d66533c (diff)
downloaddynamic-extension-ff000799c3254f52e0beabbe9c62d10c3fc4178e.tar.gz
Record format generalization
Currently, tombstone counting is bugged. But the rest of it appears to be working.
Diffstat (limited to 'include/ds')
-rw-r--r--include/ds/PriorityQueue.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/include/ds/PriorityQueue.h b/include/ds/PriorityQueue.h
index 290d5c8..22582da 100644
--- a/include/ds/PriorityQueue.h
+++ b/include/ds/PriorityQueue.h
@@ -16,14 +16,14 @@
namespace de {
-template <typename K, typename V, typename W=void>
+template <typename R>
struct queue_record {
- const Record<K, V, W> *data;
+ const R *data;
size_t version;
};
-template <typename K, typename V, typename W=void>
+template <typename R>
class PriorityQueue {
public:
PriorityQueue(size_t size) : data(size), tail(0) {}
@@ -54,7 +54,7 @@ public:
}
}
- void push(const Record<K, V, W>* record, size_t version=0) {
+ void push(const R* record, size_t version=0) {
assert(tail != this->data.size());
size_t new_idx = this->tail++;
@@ -67,7 +67,7 @@ public:
}
- queue_record<K, V, W> peek(size_t depth=0) {
+ queue_record<R> peek(size_t depth=0) {
ssize_t idx = 0;
size_t cur_depth = 0;
@@ -81,7 +81,7 @@ public:
}
private:
- std::vector<queue_record<K, V, W>> data;
+ std::vector<queue_record<R>> data;
size_t tail;
/*
@@ -124,7 +124,7 @@ private:
}
inline bool heap_cmp(size_t a, size_t b) {
- if (!data[a].data->match(data[b].data)) {
+ if (data[a].data != data[b].data) {
return *(data[a].data) < *(data[b].data);
} else if (data[a].version != data[b].version)
return data[a].version < data[b].version;