我刚开始使用
boost::fibonacci_heap
,并且对使用有一些疑问。while (!heap.empty()) {
Get heap.top() //analyze
heap.pop()
//modify some other heap elements using heap handle
heap.update(handle_of_modified_entry)
}
我的问题是
heap.update()
调用是否更新由 pop
调用释放的顶部元素。我是否导致对已释放内存的无效访问?我是否需要在 pop 之后调用 update 以确保 pop 元素已从堆中删除?