Lambda
Lambda表达式为啥叫Lambda?这是因为取自于数学系统中的Lambda calculus(
λ
\lambda
λ演算)。在C++11中,对于接受函数指针和函数符的函数可以使用匿名函数(lambda)作为其参数。
Lambda
举个例子:
// 实现一个判断是否能被三整除的函数
#include <iostream>
namespace {
constexpr int divisor = 3;
}
// 函数的实现方法
bool IsDivisibleByThree (int integer) {
return integer / divisor;
}
std::find
const double max_x = std::find(
vec.begin(), vec.end(), [z](const ZToXY& a) { return a.z == z; })->xy;
std::min_element
std::sort
std::lower_bound
https://blog.csdn.net/weixin_38505045/article/details/88656453