File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -320,12 +320,13 @@ main: () = {
320
320
321
321
Another example:
322
322
323
- ``` cpp title="Capture in a named function expression (aka lambda)" hl_lines="2 4 7 12 13 "
323
+ ``` cpp title="Capture in a named function expression (aka lambda)" hl_lines="2 4 9 14 15 "
324
324
main: () = {
325
325
price := 100;
326
- func := :() = {
327
- std::cout << "Price = " << price$ << "\n";
328
- };
326
+ func := // Note: 'func' is a named variable of deduced type initialized to ...
327
+ :() = { std::cout << "Price = " << price$ << "\n"; } // ... this lambda
328
+ ; // This is a way to declare 'local functions', which can also capture
329
+ // (In the future, Cpp2 may directly support local functions)
329
330
func ();
330
331
price = 200;
331
332
func();
You can’t perform that action at this time.
0 commit comments