another attempt at MSVC compatibility
diff --git a/theta/include/conditional_back_inserter.hpp b/theta/include/conditional_back_inserter.hpp
index e9b0590..9b33833 100644
--- a/theta/include/conditional_back_inserter.hpp
+++ b/theta/include/conditional_back_inserter.hpp
@@ -31,6 +31,15 @@
template<typename P>
conditional_back_insert_iterator(Container& c, P&& p): std::back_insert_iterator<Container>(c), p(std::forward<P>(p)) {}
+ // MSVC seems to insist on having copy constructor and assignment
+ conditional_back_insert_iterator(const conditional_back_insert_iterator& other):
+ std::back_insert_iterator<Container>(other), p(other.p) {}
+ conditional_back_insert_iterator& operator=(const conditional_back_insert_iterator& other) {
+ std::back_insert_iterator<Container>::operator=(other);
+ p = other.p;
+ return *this;
+ }
+
conditional_back_insert_iterator& operator=(typename Container::const_reference value) {
if (p(value)) std::back_insert_iterator<Container>::operator=(value);
return *this;
diff --git a/theta/include/theta_a_not_b.hpp b/theta/include/theta_a_not_b.hpp
index 5287887..db66ac7 100644
--- a/theta/include/theta_a_not_b.hpp
+++ b/theta/include/theta_a_not_b.hpp
@@ -54,6 +54,13 @@
typedef typename std::allocator_traits<A>::template rebind_alloc<uint64_t> AllocU64;
uint16_t seed_hash_;
+ class less_than {
+ public:
+ explicit less_than(uint64_t value): value(value) {}
+ bool operator()(uint64_t value) const { return value < this->value; }
+ private:
+ uint64_t value;
+ };
};
// alias with default allocator for convenience
diff --git a/theta/include/theta_a_not_b_impl.hpp b/theta/include/theta_a_not_b_impl.hpp
index 2ffca28..4343ee3 100644
--- a/theta/include/theta_a_not_b_impl.hpp
+++ b/theta/include/theta_a_not_b_impl.hpp
@@ -48,10 +48,10 @@
bool is_empty = a.is_empty();
if (b.get_num_retained() == 0) {
- std::copy_if(a.begin(), a.end(), std::back_inserter(keys), [theta](uint64_t key) { return key < theta; });
+ std::copy_if(a.begin(), a.end(), std::back_inserter(keys), less_than(theta));
} else {
if (a.is_ordered() && b.is_ordered()) { // sort-based
- std::set_difference(a.begin(), a.end(), b.begin(), b.end(), conditional_back_inserter(keys, [theta](uint64_t key) { return key < theta; }));
+ std::set_difference(a.begin(), a.end(), b.begin(), b.end(), conditional_back_inserter(keys, less_than(theta)));
} else { // hash-based
const uint8_t lg_size = lg_size_from_count(b.get_num_retained(), update_theta_sketch_alloc<A>::REBUILD_THRESHOLD);
vector_u64<A> b_hash_table(1 << lg_size, 0);