Hello there thanx to Mr. Hellios i can now modify the data inside a stl priority queue explicitly. But here is a problem i am facing. Here is some code to push value 0 to 9 (ranked 0 to 9) in a queue . And then i modify an element's rank to -1 and push a value of priority -1. And finally pop all and print 'em. but the two -1 ranked things are not coming at top, only the one i pushed is coming at top. is there any way i can make the changed node float to the top ??
You can't do that. You can't modify an element of the priority_queue without the priority_queue's knowledge
and then expect it to maintain proper sorting. To do what you want, you have to remove the element you
want to modify then re-add it as the modified value.