-
Notifications
You must be signed in to change notification settings - Fork 13k
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
BinaryHeap::retain would be useful #50671
Comments
|
If it's |
There was a discussion on the C++ subreddit recently that is related to this topic, it might be a good place to look for ideas. |
Ah right, I didn't see that signature was for replace rather than retain. I think replace would still want something that can update the original value in place, but it's not so clear to me what that'd be. |
Closing in favor of #42849. |
@Mark-Simulacrum This issue is for BinaryHeap, and #42849 is for BTreeSet/BTreeMap. If this issue remains closed, it would be a good idea to modify the other issue to include BinaryHeap as well. |
Thanks, included. |
Consider a BinaryHeap in which we need to change priority of some elements. For the moment, this only way to implement this is to drain the heap and rebuild it from scratch. It would be more efficient to be able to remove only the affected elements, so as to read them.
A variant would be a
The text was updated successfully, but these errors were encountered: