Does changing a priority queue element result in resorting the queue?

前端 未结 4 1683
抹茶落季
抹茶落季 2021-01-02 16:58

I have a priority_queue, and I want to modify some of it\'s contents (the priority value), will the queue be resorted then?

It depends if it resorts on push/pop (mor

4条回答
  •  忘掉有多难
    2021-01-02 17:27

    priority_queue copies the values you push into it. Your assignment at the end there will have zero effect on the order of the priority queue, nor the values stored inside of it.

提交回复
热议问题