Recently I noticed that C++ std::less is a class,although it simply compares the values of two objects.Here is a sample code:
template <class T> struct less {
bool operator() (const T& x, const T& y) const {return x<y;}
typedef T first_argument_type;
typedef T second_argument_type;
typedef bool result_type;
};
so what is the advantage of defining a class instead of a funciton? and I also wonder why using the 'const' keyword despite there is no data member in the class?