Suppose I have these two functions:
template<class T>
bool largerthan(T a, T b)
{
if(a>b)
return true;
return false;
}
template<class T>
int reduce(T ar[], int n)
{
list<T> buffer;
buffer.insert(buffer.begin(), ar, ar+n);
buffer.sort(largerthan);
buffer.unique();
copy(buffer.begin(),buffer.end(), ar);
return buffer.size();
}
I have two kinds of arrays for reduce(): string and long;
something happen to the red part(buffer.sort(largerthan)), the complier says that it couldn't using the function for buffer.sort(), I am not sure how to write it, and if the complier was able to pass the using type to largerthan().
Waiting for your answer, thanks.^-^