0

这已经让我发疯了 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

4

2 回答 2

0

没关系。我发现了问题。它位于调用相同算法函数的代码的不同部分。很抱歉打扰大家,感谢您提供帮助。

于 2010-12-15T15:36:12.367 回答
0

你给了它b.pprop,vs a.prop。我认为考虑到编译器未能正确解析结构定义的错误 - 检查其上方代码中的语法错误。

于 2010-12-15T14:56:24.020 回答