Tessil / ordered-map

C++ hash map and hash set which preserve the order of insertion
MIT License
512 stars 66 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. #17

Closed Tessil closed 6 years ago

Tessil commented 6 years ago

Correct moved state, a moved tsl::ordered_map or tsl::ordered_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::ordered_set<int> set = {0, 1, 2, 3, 4};
tsl::ordered_set<int> set2 = std::move(set);

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