Priority_Queue Custom class

What is the need of making compare functions because priority_queue can automatically take it element in max heap order and so we can get top elements ??

hello @ashwani225
custom class is something that we have defined so only we know what it contains and on what basis we want to order.
so its ours responsibility to teach the priority queue how to compare two object of custom class.
and thats the reason why we are making (teaching) compare class .

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.