In the Google C++ Style Guide, the section on Operator Overloading recommends against overloading any operators (\"except in rare, special circumstances\"). Specifi
Well, according to the webpage you cite, there's not much advantage for functors ("[operators] can fool our intuition into thinking that expensive operations are cheap, built-in operations.")
My felling is that one should strive to make you classes first-class objects as much as possible, which, to me, means having them understand as many operators as sensible.
It's been a while since I written a functor, but it would look something like this:
class MyClass {....}
class LessThanMyClass : std:binary_function
{
public bool operator()(MyClass lhs, MyClass rhs)
{ return /* determine if lhs < rhs */ ; }
}
vector objs;
std::sort(objs.begin(), objs.end(), LessThanMyClass());
}