forked from llvm-mirror/libcxx
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a fast
replace_top
method to std::priority_queue
.
Also `std::poke_heap(first, last)`, which assumes that the given range is in max-heap order *except* for the first element, which needs to be put into its proper place. This is just like `push_heap`, except that `push_heap` assumes the *last* element is out of order, whereas `poke_heap` assumes the *first* element is out of order. The changes in `<queue>` could use `_VSTD::poke_heap` instead of `__sift_down`, but they do not, in order to keep the `<queue>` changes usable as a single-file patch (in case someone wants to take the `<queue>` changes without the `<algorithm>` changes). The `poke_heap` approach would replace the last line of each new method with this line instead: _VSTD::poke_heap(c.begin(), c.end(), comp); https://reviews.llvm.org/D57734
- Loading branch information
1 parent
49af5dc
commit d1c84fd
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters