mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-17 12:44:42 +03:00
Corrected F.54, part 2
This commit is contained in:
@@ -3072,7 +3072,7 @@ 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
|
||||||
// notes: [&] has identical semantics and copies the this pointer under the current rules
|
// notes: [&] has identical semantics and copies the this pointer under the current rules
|
||||||
// [=,this] and [&,this] are identical in this case, and still confusing in general
|
// [=,this] and [&,this] are not much better, and confusing
|
||||||
x = 42;
|
x = 42;
|
||||||
lambda(); // calls use(42);
|
lambda(); // calls use(42);
|
||||||
x = 43;
|
x = 43;
|
||||||
|
|||||||
Reference in New Issue
Block a user