【发布时间】:2017-09-24 10:11:32
【问题描述】:
我有一个类似下面给出的结构的std::set:
struct weight{
int y;
int w;
};
比较器定义为:
bool operator <(const weight&lhs,const weight&rhs) {
return tie(lhs.y,lhs.w)<tie(rhs.y,rhs.w);
}
在什么基础上对集合进行排序?以及如何对给定参数的集合进行排序,也有人可以解释上面使用的函数的工作原理吗? 谢谢
【问题讨论】:
标签: c++ stl set operator-overloading