Operator overloading

In STL videos of unordered map and Priority Queue the hash function and compator respectively are used as a class instead of a function, but why have operator overloading been used in both, isn’t that used when we need to change functionality of some operator

@singhsimran567 the class used contains the overloaded function, actually we use operator overloading because for custom data type, we provide the seed for comparison,
hence the comparison now occurs according to this overloaded function.
Now () is used for comparison and hence it is overloaded!

Q1 how is () this being used for comparison can you please clarify
{for both unordered map’s hash funct and priority queue’s comaprtor}

Q2 why did sir specifically say that compartor in sql should be made a class and not a function but then also while making a compartor for string::sort he makes a it as a function and not a class

ans1)
objects are compared this way:
if((A,B))
{…condition satifying content…}
else{…}
here the overloaded () operator returns true/false.
ans 2) It is a necessity to pass comparator function encapsulated in class/struct, but in sort, a direct function can be passed also. It’s totally upto you to pass a class to a sort function!