cleanup
diff --git a/theta/include/theta_intersection.hpp b/theta/include/theta_intersection.hpp
index 98a8bf1..21eb35c 100644
--- a/theta/include/theta_intersection.hpp
+++ b/theta/include/theta_intersection.hpp
@@ -41,6 +41,11 @@
};
using State = theta_intersection_base<Entry, ExtractKey, pass_through_policy, Sketch, CompactSketch, Allocator>;
+ /*
+ * Constructor
+ * @param seed for the hash function that was used to create the sketch
+ * @param allocator to use for allocating and deallocating memory
+ */
explicit theta_intersection_alloc(uint64_t seed = DEFAULT_SEED, const Allocator& allocator = Allocator());
/**
diff --git a/theta/include/theta_union.hpp b/theta/include/theta_union.hpp
index 44f9b52..8504ffb 100644
--- a/theta/include/theta_union.hpp
+++ b/theta/include/theta_union.hpp
@@ -35,13 +35,13 @@
using CompactSketch = compact_theta_sketch_alloc<Allocator>;
using resize_factor = theta_constants::resize_factor;
- struct pass_through_policy {
- uint64_t operator()(uint64_t internal_entry, uint64_t incoming_entry) const {
+ struct nop_policy {
+ void operator()(uint64_t internal_entry, uint64_t incoming_entry) const {
+ unused(internal_entry);
unused(incoming_entry);
- return internal_entry;
}
};
- using State = theta_union_base<Entry, ExtractKey, pass_through_policy, Sketch, CompactSketch, Allocator>;
+ using State = theta_union_base<Entry, ExtractKey, nop_policy, Sketch, CompactSketch, Allocator>;
// No constructor here. Use builder instead.
class builder;
diff --git a/theta/include/theta_union_impl.hpp b/theta/include/theta_union_impl.hpp
index 4708d70..1ccf4d4 100644
--- a/theta/include/theta_union_impl.hpp
+++ b/theta/include/theta_union_impl.hpp
@@ -24,7 +24,7 @@
template<typename A>
theta_union_alloc<A>::theta_union_alloc(uint8_t lg_cur_size, uint8_t lg_nom_size, resize_factor rf, uint64_t theta, uint64_t seed, const A& allocator):
-state_(lg_cur_size, lg_nom_size, rf, theta, seed, pass_through_policy(), allocator)
+state_(lg_cur_size, lg_nom_size, rf, theta, seed, nop_policy(), allocator)
{}
template<typename A>
diff --git a/theta/include/theta_update_sketch_base_impl.hpp b/theta/include/theta_update_sketch_base_impl.hpp
index cb1bc2a..b91a78f 100644
--- a/theta/include/theta_update_sketch_base_impl.hpp
+++ b/theta/include/theta_update_sketch_base_impl.hpp
@@ -232,10 +232,10 @@
const size_t num_old_entries = num_entries_;
entries_ = allocator_.allocate(size);
for (size_t i = 0; i < size; ++i) EK()(entries_[i]) = 0;
- num_entries_ = 0;
+ num_entries_ = nominal_size;
// relies on consolidating non-empty entries to the front
for (size_t i = 0; i < nominal_size; ++i) {
- insert(find(EK()(old_entries[i])).first, std::move(old_entries[i])); // consider a special insert with no comparison
+ new (find(EK()(old_entries[i])).first) EN(std::move(old_entries[i]));
old_entries[i].~EN();
}
for (size_t i = nominal_size; i < num_old_entries; ++i) old_entries[i].~EN();