struct p{ int num; ll di; bool operator <(const p &x)const { return x.di<di; } };
这是我打最短路用的一段码,刚刚在用的时候发现
int num; ll di; bool operator >(const p &x)const { return di>x.di; } };
只要把小于号改个方向,这段码就会爆掉。 有没有dalao可以解释一下原理,或者有哪篇讲运算符重载比较好的博客可以推荐一下