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.

Syntax

Consider priority_queue 'pq' as a priority_queue object.

Parameter

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

Return value

None

Example 1

Output:

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



Please Share

facebook twitter google plus pinterest