diff options
author | practicalswift <practicalswift@users.noreply.github.com> | 2018-06-18 07:58:28 +0200 |
---|---|---|
committer | practicalswift <practicalswift@users.noreply.github.com> | 2018-08-27 18:19:33 +0200 |
commit | f34c8c466a0e514edac2e8683127b4176ad5d321 (patch) | |
tree | 587ba001d5d6eaae71d234009098710dd30354c3 /src/cuckoocache.h | |
parent | f180e81d5780805a28bcc71c2bb6b16076336c3c (diff) |
Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations.
Diffstat (limited to 'src/cuckoocache.h')
-rw-r--r-- | src/cuckoocache.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cuckoocache.h b/src/cuckoocache.h index 15f6873961..4d0b094fa2 100644 --- a/src/cuckoocache.h +++ b/src/cuckoocache.h @@ -397,7 +397,7 @@ public: std::array<uint32_t, 8> locs = compute_hashes(e); // Make sure we have not already inserted this element // If we have, make sure that it does not get deleted - for (uint32_t loc : locs) + for (const uint32_t loc : locs) if (table[loc] == e) { please_keep(loc); epoch_flags[loc] = last_epoch; @@ -405,7 +405,7 @@ public: } for (uint8_t depth = 0; depth < depth_limit; ++depth) { // First try to insert to an empty slot, if one exists - for (uint32_t loc : locs) { + for (const uint32_t loc : locs) { if (!collection_flags.bit_is_set(loc)) continue; table[loc] = std::move(e); @@ -467,7 +467,7 @@ public: inline bool contains(const Element& e, const bool erase) const { std::array<uint32_t, 8> locs = compute_hashes(e); - for (uint32_t loc : locs) + for (const uint32_t loc : locs) if (table[loc] == e) { if (erase) allow_erase(loc); |