Avoid self-move-assign in pop operation of binary heap. (#7942)
Summary: The current implementation of a binary heap in `util/heap.h` does a move-assign in the `pop` method. In the case that there is exactly one element stored in the heap, this ends up being a self-move-assign. This can cause trouble with certain classes, which are not prepared for this. Furthermore, it trips up the glibc STL debugger (`-D_GLIBCXX_DEBUG`), which produces an assertion failure in this case. This PR addresses this problem by not doing the (unnecessary in this case) move-assign if there is only one element in the heap. Pull Request resolved: https://github.com/facebook/rocksdb/pull/7942 Reviewed By: jay-zhuang Differential Revision: D26528739 Pulled By: ajkr fbshipit-source-id: 5ca570e0c4168f086b10308ad766dff84e6e2d03main
parent
ec76f03168
commit
cf14cb3e29
Loading…
Reference in new issue