这已经让我坚持了3个小时。有人看到这个不起作用的原因吗?stl的自定义比较器
struct sortByPropRev
{
bool operator()(const cust_type &a, const cust_type &b) const
{
return a.prop > b.prop;
}
};
...
priority_queue<cust_type, vector<cust_type>, sortByPropRev> x;
我得到的编译错误:
Error C2664: 'bool (cust_type &,cust_type &)' : cannot convert parameter 1 from 'const cust_type' to 'cust_type &'
和2更多的只是喜欢它,但在不同线路上的algorithm.h
cust_type是如何定义的? – 2010-12-15 14:58:18
'struct cust_type {int a,int b,...; cust_type(int a,int b,...):a(a),b(b){}}' – baruch 2010-12-15 15:01:58