小编vld*_*cno的帖子

可以为lambda影响性能指定名称吗?

在直接使用lambda和定义命名的lambda然后将其作为参数传递之间,性能(如果有)有什么不同?

例如:

std::sort(v.begin(), v.end(), [](int a, int b) { return a > b; });
Run Code Online (Sandbox Code Playgroud)

与此相对:

auto a_greater_than_b = [](int a, int b) { return a > b; };
std::sort(v.begin(), v.end(), a_greater_than_b);
Run Code Online (Sandbox Code Playgroud)

c++ performance lambda auto c++11

1
推荐指数
1
解决办法
93
查看次数

标签 统计

auto ×1

c++ ×1

c++11 ×1

lambda ×1

performance ×1