mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-18 05:04:41 +03:00
@@ -4151,8 +4151,6 @@ It's confusing. Writing `[=]` in a member function appears to capture by value,
|
|||||||
// ...
|
// ...
|
||||||
|
|
||||||
auto lambda = [=] { use(i, x); }; // BAD: "looks like" copy/value capture
|
auto lambda = [=] { use(i, x); }; // BAD: "looks like" copy/value capture
|
||||||
// [&] has identical semantics and copies the this pointer under the current rules
|
|
||||||
// [=,this] and [&,this] are not much better, and confusing
|
|
||||||
|
|
||||||
x = 42;
|
x = 42;
|
||||||
lambda(); // calls use(0, 42);
|
lambda(); // calls use(0, 42);
|
||||||
|
|||||||
Reference in New Issue
Block a user