mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user