This tracks the stabilization of BinaryHeap::into_iter_sorted (binary_heap_into_iter_sorted) and BinaryHeap::drain_sorted (binary_heap_drain_sorted) implemented in #65091.
EDIT much later:
Original feature request:
Currently, both BinaryHeap::into_iter and BinaryHeap::drain yield the heap elements in an arbitrary order. This seems counter-intuitive given the nature of a heap. Sadly, we can't simply change their behavior behind the scenes, as we would have to remove the implementation of DoubleEndedIterator. Should we perhaps add into_ordered_iter and drain_ordered? The implementation is pretty straightforward so I'd be happy to submit a PR.
This tracks the stabilization of
BinaryHeap::into_iter_sorted(binary_heap_into_iter_sorted) andBinaryHeap::drain_sorted(binary_heap_drain_sorted) implemented in #65091.EDIT much later:
into_sorted_vec) need to be addressed before a future attempt to stabilize.Original feature request:
Currently, both
BinaryHeap::into_iterandBinaryHeap::drainyield the heap elements in an arbitrary order. This seems counter-intuitive given the nature of a heap. Sadly, we can't simply change their behavior behind the scenes, as we would have to remove the implementation ofDoubleEndedIterator. Should we perhaps addinto_ordered_iteranddrain_ordered? The implementation is pretty straightforward so I'd be happy to submit a PR.