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 2021/03/16 21:41:02 UTC
[datasketches-cpp] branch cleanup_warnings created (now 3b900ea)
This is an automated email from the ASF dual-hosted git repository.
alsay pushed a change to branch cleanup_warnings
in repository https://gitbox.apache.org/repos/asf/datasketches-cpp.git.
at 3b900ea cleaned some warnings
This branch includes the following new commits:
new 3b900ea cleaned some warnings
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org
[datasketches-cpp] 01/01: cleaned some warnings
Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
alsay pushed a commit to branch cleanup_warnings
in repository https://gitbox.apache.org/repos/asf/datasketches-cpp.git
commit 3b900eaab2988514980ac7abacf92ff31f619022
Author: AlexanderSaydakov <Al...@users.noreply.github.com>
AuthorDate: Tue Mar 16 14:40:31 2021 -0700
cleaned some warnings
---
fi/include/frequent_items_sketch_impl.hpp | 16 ++++++++--------
fi/test/reverse_purge_hash_map_test.cpp | 2 +-
kll/include/kll_sketch_impl.hpp | 2 +-
kll/test/kll_sketch_test.cpp | 4 ++--
req/include/req_compactor_impl.hpp | 2 +-
sampling/include/var_opt_sketch_impl.hpp | 2 +-
sampling/test/var_opt_sketch_test.cpp | 2 +-
7 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/fi/include/frequent_items_sketch_impl.hpp b/fi/include/frequent_items_sketch_impl.hpp
index b61ee55..b9c9e55 100644
--- a/fi/include/frequent_items_sketch_impl.hpp
+++ b/fi/include/frequent_items_sketch_impl.hpp
@@ -65,7 +65,7 @@ template<typename T, typename W, typename H, typename E, typename S, typename A>
void frequent_items_sketch<T, W, H, E, S, A>::merge(const frequent_items_sketch& other) {
if (other.is_empty()) return;
const W merged_total_weight = total_weight + other.get_total_weight(); // for correction at the end
- for (auto &it: other.map) {
+ for (auto it: other.map) {
update(it.first, it.second);
}
offset += other.offset;
@@ -76,7 +76,7 @@ template<typename T, typename W, typename H, typename E, typename S, typename A>
void frequent_items_sketch<T, W, H, E, S, A>::merge(frequent_items_sketch&& other) {
if (other.is_empty()) return;
const W merged_total_weight = total_weight + other.get_total_weight(); // for correction at the end
- for (auto &it: other.map) {
+ for (auto it: other.map) {
update(std::move(it.first), it.second);
}
offset += other.offset;
@@ -147,7 +147,7 @@ template<typename T, typename W, typename H, typename E, typename S, typename A>
typename frequent_items_sketch<T, W, H, E, S, A>::vector_row
frequent_items_sketch<T, W, H, E, S, A>::get_frequent_items(frequent_items_error_type err_type, W threshold) const {
vector_row items(map.get_allocator());
- for (auto &it: map) {
+ for (auto it: map) {
const W lb = it.second;
const W ub = it.second + offset;
if ((err_type == NO_FALSE_NEGATIVES && ub > threshold) || (err_type == NO_FALSE_POSITIVES && lb > threshold)) {
@@ -192,7 +192,7 @@ void frequent_items_sketch<T, W, H, E, S, A>::serialize(std::ostream& os) const
A alloc(map.get_allocator());
T* items = alloc.allocate(num_items);
uint32_t i = 0;
- for (auto &it: map) {
+ for (auto it: map) {
new (&items[i]) T(it.first);
weights[i++] = it.second;
}
@@ -208,7 +208,7 @@ template<typename T, typename W, typename H, typename E, typename S, typename A>
size_t frequent_items_sketch<T, W, H, E, S, A>::get_serialized_size_bytes() const {
if (is_empty()) return PREAMBLE_LONGS_EMPTY * sizeof(uint64_t);
size_t size = PREAMBLE_LONGS_NONEMPTY * sizeof(uint64_t) + map.get_num_active() * sizeof(W);
- for (auto &it: map) size += S().size_of_item(it.first);
+ for (auto it: map) size += S().size_of_item(it.first);
return size;
}
@@ -248,7 +248,7 @@ auto frequent_items_sketch<T, W, H, E, S, A>::serialize(unsigned header_size_byt
A alloc(map.get_allocator());
T* items = alloc.allocate(num_items);
uint32_t i = 0;
- for (auto &it: map) {
+ for (auto it: map) {
new (&items[i]) T(it.first);
weights[i++] = it.second;
}
@@ -431,14 +431,14 @@ string<A> frequent_items_sketch<T, W, H, E, S, A>::to_string(bool print_items) c
os << "### End sketch summary" << std::endl;
if (print_items) {
vector_row items;
- for (auto &it: map) {
+ for (auto it: map) {
items.push_back(row(&it.first, it.second, offset));
}
// sort by estimate in descending order
std::sort(items.begin(), items.end(), [](row a, row b){ return a.get_estimate() > b.get_estimate(); });
os << "### Items in descending order by estimate" << std::endl;
os << " item, estimate, lower bound, upper bound" << std::endl;
- for (auto &it: items) {
+ for (auto it: items) {
os << " " << it.get_item() << ", " << it.get_estimate() << ", "
<< it.get_lower_bound() << ", " << it.get_upper_bound() << std::endl;
}
diff --git a/fi/test/reverse_purge_hash_map_test.cpp b/fi/test/reverse_purge_hash_map_test.cpp
index a74345c..a1a9c27 100644
--- a/fi/test/reverse_purge_hash_map_test.cpp
+++ b/fi/test/reverse_purge_hash_map_test.cpp
@@ -40,7 +40,7 @@ TEST_CASE("reverse purge hash map: iterator", "[frequent_items_sketch]") {
reverse_purge_hash_map<int> map(3, 4, std::allocator<int>());
for (int i = 0; i < 11; i++) map.adjust_or_insert(i, 1); // this should fit with no purge
int sum = 0;
- for (auto &it: map) sum += it.second;
+ for (auto it: map) sum += it.second;
REQUIRE(sum == 11);
}
diff --git a/kll/include/kll_sketch_impl.hpp b/kll/include/kll_sketch_impl.hpp
index 772e9b0..3492058 100644
--- a/kll/include/kll_sketch_impl.hpp
+++ b/kll/include/kll_sketch_impl.hpp
@@ -380,7 +380,7 @@ size_t kll_sketch<T, C, S, A>::get_serialized_size_bytes() const {
size_t size = DATA_START + num_levels_ * sizeof(uint32_t);
size += S().size_of_item(*min_value_);
size += S().size_of_item(*max_value_);
- for (auto& it: *this) size += S().size_of_item(it.first);
+ for (auto it: *this) size += S().size_of_item(it.first);
return size;
}
diff --git a/kll/test/kll_sketch_test.cpp b/kll/test/kll_sketch_test.cpp
index def96f6..891b83b 100644
--- a/kll/test/kll_sketch_test.cpp
+++ b/kll/test/kll_sketch_test.cpp
@@ -71,7 +71,7 @@ TEST_CASE("kll sketch", "[kll_sketch]") {
REQUIRE(sketch.get_CDF(split_points, 1).size() == 0);
int count = 0;
- for (auto& it: sketch) {
+ for (auto it: sketch) {
(void) it; // to suppress "unused" warning
++count;
}
@@ -104,7 +104,7 @@ TEST_CASE("kll sketch", "[kll_sketch]") {
REQUIRE(quantiles[2] == 1.0);
int count = 0;
- for (auto& it: sketch) {
+ for (auto it: sketch) {
REQUIRE(it.second == 1);
++count;
}
diff --git a/req/include/req_compactor_impl.hpp b/req/include/req_compactor_impl.hpp
index 3d5cce0..2f6a4e3 100755
--- a/req/include/req_compactor_impl.hpp
+++ b/req/include/req_compactor_impl.hpp
@@ -389,7 +389,7 @@ auto req_compactor<T, C, A>::deserialize_items(std::istream& is, const S& serde,
// serde did not throw, enable destructors
items.get_deleter().set_destroy(true);
if (!is.good()) throw std::runtime_error("error reading from std::istream");
- return std::move(items);
+ return items;
}
template<typename T, typename C, typename A>
diff --git a/sampling/include/var_opt_sketch_impl.hpp b/sampling/include/var_opt_sketch_impl.hpp
index 16f8216..33be587 100644
--- a/sampling/include/var_opt_sketch_impl.hpp
+++ b/sampling/include/var_opt_sketch_impl.hpp
@@ -334,7 +334,7 @@ size_t var_opt_sketch<T,S,A>::get_serialized_size_bytes() const {
num_bytes += (h_ / 8) + (h_ % 8 > 0);
}
// must iterate over the items
- for (auto& it: *this)
+ for (auto it: *this)
num_bytes += S().size_of_item(it.first);
return num_bytes;
}
diff --git a/sampling/test/var_opt_sketch_test.cpp b/sampling/test/var_opt_sketch_test.cpp
index c1121c5..44560c9 100644
--- a/sampling/test/var_opt_sketch_test.cpp
+++ b/sampling/test/var_opt_sketch_test.cpp
@@ -220,7 +220,7 @@ TEST_CASE("varopt sketch: cumulative weight", "[var_opt_sketch]") {
}
double output_sum = 0.0;
- for (auto& it : sk) { // std::pair<int, weight>
+ for (auto it : sk) { // std::pair<int, weight>
output_sum += it.second;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org