Q:

It is possible to use T::operator< as default parameter for template function?

I wonder if it is possible to use operator< or some other as default parameter of some function.
Some stupid trivial example:
template <typename T>
void compare(std::function<bool(T, T)> lessThan = T::operator<);

I try to do this thing for int as T, but of course I get an error:
error: ‘operator<’ is not a member of ‘int’

I really don't know if it is possible till operator< as I know isn't a static function.
Do you have any idea, if and how it can be done?
Any help will be apreciated! :)

A:

It is almost always a bad idea to use std::function with template arguments in a template function.
std::function is type erasure, and template arguments are type deduction.  Type erasure and type deduction are opposites of each other.  Doing both is like building a house only to blow it up and build another one.
template <class T, class C=std::less<T>>
void compare(C&& c = {});

If you want to replace the compartor you can do
compare<int>( some_other_comparator );

