Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/cuckoocache.h
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,12 @@ class cache
* for the next iteration.
*/
last_loc = locs[(1 + (std::find(locs.begin(), locs.end(), last_loc) - locs.begin())) & 7];
std::swap(table[last_loc], e);
// Avoid std::swap here: when Element is bool, table[last_loc]
// is a std::vector<bool>::reference proxy and cannot be swapped
// directly with the local bool on newer standard libraries.
Element evicted = std::move(table[last_loc]);
table[last_loc] = std::move(e);
e = std::move(evicted);
// Can't std::swap a std::vector<bool>::reference and a bool&.
bool epoch = last_epoch;
last_epoch = epoch_flags[last_loc];
Expand Down