Confusion with operator overloading

why did we created a class for the comparator and why did we need need overload () fot it

@chemant077
The inbuilt logic does not sort the elements according to our needs
So we use a custom comparator
And for priorirty_queue we need to pass a class with overloaded operator ()
This is the default implementation of PQ and no logic behind it as such
You can read more about it at this link

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.