Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jul 23, 2018

Conversation

Tessil
Copy link
Owner

@Tessil Tessil commented Jul 23, 2018

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);

@Tessil Tessil merged commit cb3564e into master Jul 23, 2018
@Tessil Tessil deleted the correct_moved_state branch July 31, 2018 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant