-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Consider use of IndexMap::(swap_)remove
and IndexSet::(swap_)remove
#120456
Comments
For the map that appears in the interpreter, this used to be an |
If you only care about determinism, then either method will work, and But some people were surprised by the change in order -- see: indexmap-rs/indexmap#241 |
Another idea: if there are cases that do care about order but don't want to pay the price for |
I think shift has fewer requirements on determinism, right? Removal order doesn't need to be deterministic to preserve order amongst remaining elements in particular. |
Yeah, I suppose that's true -- |
#120454 (comment)
indexmap
2.2.0 made theremove
methods deprecated, as they forward directly toswap_remove
. #120454 will update these callsites to useswap_remove
, but we should consider if this is the correct behaviour. Alternatives areshift_remove
(invalidating existing indexes) or using a different map.The text was updated successfully, but these errors were encountered: