c++11 lamda函数

https://www.cprogramming.com/c++11/c++11-lambda-closures.html
https://www.cnblogs.com/lidabo/p/3908663.html

auto handle = [] () {
};

  1. 闭包 []
    闭包的作用是对外部变量的捕捉(capture)
    [] Capture nothing (or, a scorched earth strategy?)
    [&] Capture any referenced variable by reference
    [=] Capture any referenced variable by making a copy
    [=, &foo] Capture any referenced variable by making a copy, but capture variable foo by reference
    [bar] Capture bar by making a copy; don't copy anything else
    [this] Capture the this pointer of the enclosing class
  2. 参数列表 ()
  3. 函数体{}

后续补充

你可能感兴趣的:(c++11 lamda函数)