You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by jm...@apache.org on 2020/06/02 21:51:06 UTC
[incubator-datasketches-cpp] 05/09: lambda as rvalue
This is an automated email from the ASF dual-hosted git repository.
jmalkin pushed a commit to branch patch_for_rc4
in repository https://gitbox.apache.org/repos/asf/incubator-datasketches-cpp.git
commit 97dcd5b28e55f630d087c80e46a8c7a097f87e4b
Author: AlexanderSaydakov <Al...@users.noreply.github.com>
AuthorDate: Fri May 29 17:57:25 2020 -0700
lambda as rvalue
---
theta/include/theta_a_not_b_impl.hpp | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/theta/include/theta_a_not_b_impl.hpp b/theta/include/theta_a_not_b_impl.hpp
index 8951a8f..2ffca28 100644
--- a/theta/include/theta_a_not_b_impl.hpp
+++ b/theta/include/theta_a_not_b_impl.hpp
@@ -46,13 +46,12 @@ compact_theta_sketch_alloc<A> theta_a_not_b_alloc<A>::compute(const theta_sketch
const uint64_t theta = std::min(a.get_theta64(), b.get_theta64());
vector_u64<A> keys;
bool is_empty = a.is_empty();
- auto less_than_theta = [theta](uint64_t key) { return key < theta; };
if (b.get_num_retained() == 0) {
- std::copy_if(a.begin(), a.end(), std::back_inserter(keys), less_than_theta);
+ std::copy_if(a.begin(), a.end(), std::back_inserter(keys), [theta](uint64_t key) { return key < 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, less_than_theta));
+ std::set_difference(a.begin(), a.end(), b.begin(), b.end(), conditional_back_inserter(keys, [theta](uint64_t key) { return key < 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);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org