...
In this compliant solution, the inner lambda captures i
by copy instead of by reference:.
Code Block | ||||
---|---|---|---|---|
| ||||
auto g(int val) { auto outer = [val] { int i = val; auto inner = [i] { return i + 30; }; return inner; }; return outer(); } void f() { auto fn = g(12); int j = fn(); } |
...