aboutsummaryrefslogtreecommitdiff
path: root/src/test/cuckoocache_tests.cpp
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2018-06-18 07:58:28 +0200
committerpracticalswift <practicalswift@users.noreply.github.com>2018-08-27 18:19:33 +0200
commitf34c8c466a0e514edac2e8683127b4176ad5d321 (patch)
tree587ba001d5d6eaae71d234009098710dd30354c3 /src/test/cuckoocache_tests.cpp
parentf180e81d5780805a28bcc71c2bb6b16076336c3c (diff)
Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations.
Diffstat (limited to 'src/test/cuckoocache_tests.cpp')
-rw-r--r--src/test/cuckoocache_tests.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/test/cuckoocache_tests.cpp b/src/test/cuckoocache_tests.cpp
index ec7aba34ca..dbceb9d2e0 100644
--- a/src/test/cuckoocache_tests.cpp
+++ b/src/test/cuckoocache_tests.cpp
@@ -82,11 +82,11 @@ static double test_cache(size_t megabytes, double load)
*/
std::vector<uint256> hashes_insert_copy = hashes;
/** Do the insert */
- for (uint256& h : hashes_insert_copy)
+ for (const uint256& h : hashes_insert_copy)
set.insert(h);
/** Count the hits */
uint32_t count = 0;
- for (uint256& h : hashes)
+ for (const uint256& h : hashes)
count += set.contains(h, false);
double hit_rate = ((double)count) / ((double)n_insert);
return hit_rate;
@@ -323,7 +323,7 @@ static void test_cache_generations()
reads.push_back(inserts[i]);
for (uint32_t i = n_insert - (n_insert / 4); i < n_insert; ++i)
reads.push_back(inserts[i]);
- for (auto h : inserts)
+ for (const auto& h : inserts)
c.insert(h);
}
};