为什么这样自定义操作符不行
struct CCC
{
int i;
int j;
};
struct ABC
{
bool operator <(const CCC& a1, const CCC& a2) {return a1.i < a2.i;}
};
我想把这个ABC传给sort,编译无法通过
能说下原因吗
[解决办法]
struct ABC
{
bool operator ()(const CCC& a1, const CCC& a2) {return a1.i < a2.i;}
};