用STL时经常用到
PS:这里有个巨坑,把重载写在STL里常数会爆炸,分分钟大数据TLE
所以就把重载放在结构体里啦
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
//以priority_queue的重载为例 //priority_queue默认大根堆 struct uct { int a,b; bool operator<(nde uuz) const{ return val>uuz.val; } };
用STL时经常用到
PS:这里有个巨坑,把重载写在STL里常数会爆炸,分分钟大数据TLE
所以就把重载放在结构体里啦
//以priority_queue的重载为例 //priority_queue默认大根堆 struct uct { int a,b; bool operator<(nde uuz) const{ return val>uuz.val; } };
转载于:https://www.cnblogs.com/sun123zxy/p/operator.html