sir i am unable to understand how internally the “a.dist()<b.dist()” arranges the element of priority queue.
Internal mechanism behind the functors
The comparison function is a binary function that must return true if the first argument is strictly less than the second. The implementation uses this function to compare two elements of the container to determine which should precede which others - so a and b may be any two elements in your container. This function must give a strict weak ordering over the elements. That is:
An element is never less than itself
If x < y, then it is not the case that y < x
If x < y and y < z, then x < z
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.
so if a<b is true then a will precede b else b will precede a.