c++ STL中用来排序的自定义比较函数的机制是什么
如将容器中的整形值按降序排列
bool camp(const int &a,const int &b)
{
if(a!=b) return a>b;
else return a>b;
}
. . . .
sort(v.begin(),v.end(),camp);
我是新手,望高手详细指导,感谢!
[解决办法]
camp不对啊。逻辑不对。
[解决办法]
bool comp(const int &a,const int &b){ return a>b;}