std::sort的妙用(1)
有时候需要按照结构体中某项数值进行排序,而结构体中的其他数值则不能改变。例如,按照成绩的高低对学生进行排序,而学生这一结构体中包含了学号,姓名等其他信息。使用std::sort就很方便CODEstruct edge{ int from, to, cost; };bool comp(const edge &e1, const edge &e2){ return e1.cost < e2