【发布时间】:2010-12-15 14:51:53
【问题描述】:
这已经让我发疯了 3 个小时。有人知道这不起作用的原因吗?
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 的不同行上
【问题讨论】:
-
struct cust_type {int a, int b, ...; cust_type(int a, int b, ...) : a(a), b(b) {} }
标签: stl priority-queue comparator