【发布时间】:2020-05-24 06:27:48
【问题描述】:
vector<vector<int>> reconstructQueue(vector<vector<int>> &people) {
auto cmp = [](const vector<int> &a, const vector<int> &b) {
return a[0] > b[0] || (a[0] == b[0] && a[1] < b[1]);
};
sort(people.begin(), people.end(), cmp);
大家好,谁能给我解释一下 auto cmp... 部分以及如何在排序功能中使用它,任何帮助将不胜感激:)
【问题讨论】:
-
Google lambdas 或 lambda 函数 用于 C++。
标签: c++ comparator