关于 instantiated from here
struct node{
int x, y;
node(int a = 0, int b = 0) {
x = a;
y = b;
}
};
int main() {
int i, j, k, n, m, t, time;
node temp, nod;
cin >> k;
while (k--) {
time = 0;
priority_queue<node> pri_q; //出错 instantiated from here
queue<node> q;
……
}
……
}
出错原因:对于自定义类型,则必须自己重载 operator< 或者自己写仿函数:
bool operator<( node a, node b ) {
return a.x < b.x;
}