Remove item from priority queue in C ++ stl

Do I have a priority queue with an ad

priority_queue<<Node>,vector<Node>,myComp> openQ

I insert node objects into it. but at some point I need to remove an element from it. (do not remove top element)

Currently, to remove it, I delete the item and put it in an array. if you need the topmost element then expect me to push the other elements in the array.

This is similar to linear search and delete. I know that it is not effective, and I am looking for several ways.

+3
source share
2 answers

priority_queue . pop. , . , std::map.

, std::make_heap. . , .

+5

std:: set - orderd . , .

, , , .

+1

Source: https://habr.com/ru/post/1718614/


All Articles