我在使用list时.存储的是一个结构.
可是sort参数是一个greater<>
我只好在自己的结构中重载操作符.
如
struct tnode{
int x;
string s;
friend bool operator > (tnode T1, tnode T2)
{
return T1.x > T2.x
}
};
还有别的方法吗?
可是sort参数是一个greater<>
我只好在自己的结构中重载操作符.
如
struct tnode{
int x;
string s;
friend bool operator > (tnode T1, tnode T2)
{
return T1.x > T2.x
}
};
还有别的方法吗?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货