问个问题
  • 板块学术版
  • 楼主zjh114514
  • 当前回复10
  • 已保存回复10
  • 发布时间2024/1/14 13:53
  • 上次更新2024/1/14 16:28:11
查看原帖
问个问题
773944
zjh114514楼主2024/1/14 13:53
#include <iostream>
#include <vector>
#include <algorithm>

int main()
{
    std::vector<int> a = {...};
    std::sort(a.begin(), a.end(), [](int x, int y) { return x <= y; });
    for (int i : a) std::cout << i << ' ';
    return 0;
}

lambda 里写 <= 或 < 的效果都一样吗

2024/1/14 13:53
加载中...