且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Lambda捕获和成员变量

更新时间:2023-11-11 12:31:22

成员变量可以永远不会被捕获的值。被值捕获的是隐藏的这个指针用于访问它们。因此,它通过值捕获指针,这意味着它通过引用捕获此对象(及其成员)。

Member variables can never be captured by value. What's being captured by value is the implicit this pointer used to access them. Therefore, it's capturing a pointer by value, which means it captures this object (and its members) by reference.