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. 函数体{}

后续补充

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容