I want to customizing sort template and map template in C++
Here are for comparing,
struct Greater1
{
bool operator() (string A, string B)
{
string AB = A + B;
string BA = B + A;
return (AB >BA);
}
};
static bool Greater2(string A, string B)
{
string AB = A + B;
string BA = B + A;
return (AB >BA);
}
After my test Greater1 works for map and Greater2 works for sort. I also got some information form CPLUSPLUS and found that both and map should use both of function pointer and function object. My question is why Greater2 could work for map and Greater1 could work for sort.