Skip to content
Snippets Groups Projects
Commit 187f2b1b authored by Michaël El Kharroubi's avatar Michaël El Kharroubi :satellite:
Browse files

Lambda and captures done

parent de7f99ca
Branches
No related tags found
No related merge requests found
......@@ -278,6 +278,30 @@ int x = add_cst(10); // x vaut 12
])
]
#slide(title: "Les captures totales")[
On peut également copier l'environnement au complet :
#box(columns(2, gutter: 22pt)[
== Par copie
```cpp
int var = 5;
auto add_cst = [=](int i)
{ return i+var; };
var = 2;
int x = add_cst(10); // x vaut 15
```
#colbreak()
== Par référence
```cpp
int var = 5;
auto add_cst = [&](int i)
{ return i+var;};
var = 2;
int x = add_cst(10); // x vaut 12
```
])
]
#new-section-slide("Algorithmes STL")
#new-section-slide("Notions à retenir")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment