1:lambda表示方法
auto lambda = [](){};
lambda();
sizeof(lambda) = 1;
等价于类
class lambda{ pulic operator()()const{ } };
2:带参数的Lambda表达式
int b = 2 int c = 3; auto lambda = [b,&c](int a){ std::cout<<a<<b<<c<<std::endl;}; lambda(1);
等价于类:
class lambda{ pulic operator()(int a)const{ std::cout<<a<<b<<c<<std::endl; } lambda(int b,int& c):m_b(b),m_c(c){} private: int m_b; int& m_c; };
lambda l(b,c);
l(1);