我有这些在我的文件的开头:C++ priority_queue没有推?
#include <queue>
typedef struct cell_s {
unsigned int x;
unsigned int y;
unsigned int ambiguity = 9;
} cell_t;
// so the priority_queue can sort the structs:
bool operator<(const cell_t &a, const cell_t &b) {
return a.ambiguity < b.ambiguity;
}
在我宣布一个priority_queue为一类的私有成员相同的文件,像这样:
priority_queue<cell_t> blankCellQueue;
然后,我有一个
cell_t cell;
cell.x = x;
cell.y = y;
blankCellQueue.push(cell);
但Xcode是呈现在我的共享的最后一行这样的警告:包含这些行同一类的成员函数
“调用'push'时没有匹配的成员函数”。
为什么你像使用C++时那样声明你的struct C? – Caesar 2013-02-28 20:21:52
请填写完整的例子。 – 2013-02-28 20:25:46
编译器是否还有其他错误? – 2013-02-28 20:30:16