I am considering the general case, the following is just a simple example encountered which is easy to handle but has evoked my thoughts.
For example, I am using the sort() function of <algorithm>.
Instead of defining a function as
bool cmp (int n1, int n2)
{
return n1 > n2;
}
and
sort (arr, arr + N, cmp);
in the main function, I am wondering whether I can pass a pointer to the operator >, just as what I do to a pointer to a function, to the sort function. If so, how do I implement it?