Javatpoint Logo
Javatpoint Logo

C++ priority_queue swap()

C++ priority_queue swap() function is used to swap the contents of one priority queue with another priority queue of same type and size.


Consider priority_queue 'pq' as a priority_queue object.


pq1: It is a priority_queue whose contents are to be swapped.

Return value


Example 1


elements in pqueue : 60 30 20 10 10 
elements in mqueue : 8 6 3 2 1 
Next TopicC++ priority_queue

Help Others, Please Share

facebook twitter pinterest