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
Unresolved Questions
- What is the best way to check if an item exists in a
BinaryHeap?
Feature gate:
#![feature(binary_heap_contains_remove)]This is a tracking issue for
BinaryHeap::containsandBinaryHeap::remove. These methods are missing from theBinaryHeapAPI and both are common operations that one would expect to have for any general-purpose container.Previous discussion: #66724.
Public API
Steps / History
BinaryHeap::containsandBinaryHeap::remove#82002Unresolved Questions
BinaryHeap?