You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by al...@apache.org on 2020/07/02 18:16:13 UTC
[incubator-datasketches-cpp] branch tuple_sketch updated: better
way to specify iterators
This is an automated email from the ASF dual-hosted git repository.
alsay pushed a commit to branch tuple_sketch
in repository https://gitbox.apache.org/repos/asf/incubator-datasketches-cpp.git
The following commit(s) were added to refs/heads/tuple_sketch by this push:
new 9fed4b2 better way to specify iterators
9fed4b2 is described below
commit 9fed4b25268ecdf43e34a3730b9259ad532d1e6a
Author: AlexanderSaydakov <Al...@users.noreply.github.com>
AuthorDate: Thu Jul 2 11:14:01 2020 -0700
better way to specify iterators
---
tuple/include/theta_intersection_base_impl.hpp | 2 +-
tuple/include/theta_union_base_impl.hpp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tuple/include/theta_intersection_base_impl.hpp b/tuple/include/theta_intersection_base_impl.hpp
index 475c1b7..5f776c4 100644
--- a/tuple/include/theta_intersection_base_impl.hpp
+++ b/tuple/include/theta_intersection_base_impl.hpp
@@ -143,7 +143,7 @@ CS theta_intersection_base<EN, EK, P, S, CS, A>::get_result(bool ordered) const
std::vector<EN, A> entries_copy;
if (num_entries_ > 0) {
entries_copy.reserve(num_entries_);
- std::copy_if(&entries_[0], &entries_[1 << lg_size_], std::back_inserter(entries_copy), key_not_zero<EN, EK>());
+ std::copy_if(entries_, entries_ + (1 << lg_size_), std::back_inserter(entries_copy), key_not_zero<EN, EK>());
if (ordered) std::sort(entries_copy.begin(), entries_copy.end(), comparator());
}
return CS(is_empty_, ordered, seed_hash_, theta_, std::move(entries_copy));
diff --git a/tuple/include/theta_union_base_impl.hpp b/tuple/include/theta_union_base_impl.hpp
index a649b22..f6f3613 100644
--- a/tuple/include/theta_union_base_impl.hpp
+++ b/tuple/include/theta_union_base_impl.hpp
@@ -64,7 +64,7 @@ CS theta_union_base<EN, EK, P, S, CS, A>::get_result(bool ordered) const {
} else {
std::copy_if(table_.begin(), table_.end(), std::back_inserter(entries), key_not_zero_less_than<uint64_t, EN, EK>(theta));
if (entries.size() > nominal_num) {
- std::nth_element(&entries[0], &entries[nominal_num], &entries[entries.size()], comparator());
+ std::nth_element(entries.begin(), entries.begin() + nominal_num, entries.end(), comparator());
theta = EK()(entries[nominal_num]);
entries.resize(nominal_num);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org