Skip to content

Commit c9d48c6

Browse files
committed
[lambda] Correct a lambda capture.
1 parent ce7e89b commit c9d48c6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

talk/morelanguage/lambda.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,11 @@
174174
\begin{exampleblock}{See the difference between val and ref}
175175
\begin{cppcode*}{}
176176
int data[]{1,9,3,8,3,7,4,6,5};
177-
int increment = 3;
177+
int inc = 3;
178178
auto val = [ inc](int x) { return x+inc; };
179179
auto ref = [&inc](int x) { return x+inc; };
180180

181-
increment = 4;
181+
inc = 4;
182182

183183
for(int& i : data) i = val(i); // increments by 3
184184
for(int& i : data) i = ref(i); // increments by 4

0 commit comments

Comments
 (0)