-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Add a min heap option to PriorityQueue #15947
Copy link
Copy link
Closed
Labels
A-collectionsArea: `std::collections`Area: `std::collections`C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-collectionsArea: `std::collections`Area: `std::collections`C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Currently
PriorityQueuedefaults to a max-heap and if you want to use it as a min-heap you need to overloadOrdand change the comparison.But you should be able to use the default ordering and simply specify that you want a min-heap, so we can use it for types like
(uint, &str)for example.The simple idea would be to simply make a
new_min_heapand amin_heap_with_capacityconstructors.Thoughts?