RT,对于在结构体内部重载运算符,以下两种写法:
第一种:
struct Node{
int val;
bool operator<(const Node &x) const{
return val<x.val;
}
}e[maxm];
与第二种:
struct Node{
int val;
bool operator<(const Node &x){
return val<x.val;
}
}e[maxm];
第一种写法是最标准的写法,而第二种写法在本地运行无误,在洛谷IDE运行无误,但是在某些OJ上提交就会CE,请问这是为什么QAQ
以及,在结构体外重载运算符,这两种写法:
第一种:
bool operator<(const Node &x,const Node &y){
return x.val<y.val;
}
第二种:
bool operator<(Node &x,Node &y){
return x.val<y.val;
}
这两种也是同样的问题。。。第一种是最标准的,但第二种在本地和洛谷IDE运行无误,但是在某些OJ上提交就会CE。。。。请问是为什么QAQ
感谢诸位巨佬!