Closed
Description
Feature gate: #![feature(binary_heap_contains_remove)]
This is a tracking issue for BinaryHeap::contains
and BinaryHeap::remove
. These methods are missing from the BinaryHeap
API and both are common operations that one would expect to have for any general-purpose container.
Previous discussion: #66724.
Public API
impl<T: Ord> BinaryHeap<T> {
pub fn contains<Q: ?Sized>(&self, item: &Q) -> bool
where
T: Borrow<Q>,
Q: PartialEq;
pub fn remove<Q: ?Sized>(&self, item: &Q) -> Option<T>
where
T: Borrow<Q>,
Q: PartialEq;
}
Steps / History
- Implementation: Add
BinaryHeap::contains
andBinaryHeap::remove
#82002 - Final commenting period (FCP)
- Stabilization PR
Unresolved Questions
- What is the best way to check if an item exists in a
BinaryHeap
?