Can we change the comparator of sets, priority_queue at run time in c++?

Revision en1, by slow_hare, 2021-10-11 16:37:53

I had a solution to a problem which included priority queue.

I wish to know if we can change the comparator of priority queue at run time like if we initially had the declaration as priority_queue<int> pq which will store no.s in non-increasing order, can I use the same priority queue to store no.s in increasing order after pq.clear()

Thanks

Tags comparators, set priority queue

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English slow_hare 2021-10-11 16:41:56 1
en1 English slow_hare 2021-10-11 16:37:53 431 Initial revision (published)