cleaned some warnings
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 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 @@
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 @@
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 @@
// 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 @@
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 @@
}
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;
}