tags:

views:

234

answers:

1

Hi Is i have a priority queue with declaration

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

i am inserting node objects into it. but at some time i have to delete the element from it. (not to remove the top element)

Currently to delete it i am popping the element and putting it in array. if the top most element is desired then expect it i push other elements in array.

This is like linear search and delete. I know its not efficient and i am looking for some better ways

+4  A: 

priority_queue class is designed for using as queue with priorities. And it designed to remove elements with pop function. If you want to get different behavior you should use different class. For instance, std::map.

Kirill V. Lyadvinsky