C++ priority_queue emplace()

C++ priority_queue emplace() function is used to add a new element in priority-queue. This new element is added to the top of the priority-queue.

Syntax

Consider priority_queue 'pq' as a priority_queue object.

Parameter

Value: This element is inserted into the priority-queue is passed as the parameter.

Return value

None

Example 1

Output:

mypqueue = India Hindustan Bharat 

Example 2

Output:

mypqueue = 3 2 1 

Example 3

Output:

mypqueue = c b a 



Latest Courses