首页 > 解决方案 > 排序功能和容器的定制订单

问题描述

sort(intervals.begin(), intervals.end(), [](const vector<int>& a, const vector<int>& b) { return a[0] < b[0];});

自定义的ordersort通常是bool函数,[]这里是什么意思?

以及为什么容器的定制订单是struct一样的

struct cmp {
    bool operator()(Node a, Node b) {
        if (a.x == b.x) return a.y > b.y;
        return a.x > b.x;
    }
};

forsort是一个布尔函数吗?有没有参考?

标签: c++sorting

解决方案


推荐阅读