priority_queue class is used for the operations on a single ended priority queue.
A priority_queue class is declared as:
template <class T, class Container = vector<T>, class Comp = less<Container::value_type>> class priority_queue
Types of priority_queue constructors:
Type-1: Empty priority_queue
explicit priority_queue(const Comp &a = Comp( ), Container &b = Container( ));
Type-2: priority_queue that has elements in range i and j.
template <class InIter> priority_queue(InIter i, InIter j, const Comp &a = Comp( ), Container &b = Container( ));
Member functions of priority_queue:
1) size() function: It is used to return the size of the priority_queue.
2) empty( ) function: It returns true if priority_queue is empty, otherwise false.
3) push( ) function: It is used to add an element at end of priority_queue.
4) pop( ) function: It is used to remove first element in priority_queue.
5) top( ) function: It is used to return a reference to element if highest priority.