C++ lambda表达式

1 lambda表达式定义

lambda_declearation.png

2 lambda [] 使用

lambda_capture.png

[&epsilon] capture by reference
[&] captures all variables used in the lambda by reference
[=] captures all variables used in the lambda by value
[&, epsilon] captures variables like with [&], but epsilon by value
[=, &epsilon] captures variables like with [=], but epsilon by reference

你可能感兴趣的:(C++ lambda表达式)