Tessil / sparse-map

C++ implementation of a memory efficient hash map and hash set
MIT License
334 stars 36 forks source link

Bug correction, set a moved hash map/set in a valid state so that it can still be used even after a move #3

Closed Tessil closed 6 years ago

Tessil commented 6 years ago

Correct moved state, a moved tsl::sparse_map or tsl::sparse_set can now still be used after a move. Previously the map ended up in a invalid state after a move but the standard mandates that a moved object should be in a valid (but unspecified) state so that it can still be used after a move.

The following code will now work:

tsl::sparse_set<int> set = {0, 1, 2, 3, 4};
tsl::sparse_set<int> set2 = std::move(set);

set.erase(0);
set.find(0);
set.insert(0);