|
|
|
|
|
by binary132
897 days ago
|
|
The difference is negligible in real syntax: auto my_closure = [](int x, int y) { return x + y; };
let my_closure = |x: int, y: int| { x + y }
and frankly, the option of an explicit capture-list with aliases and mixing moves and copies is a benefit: int sum = 0, diff = 0;
auto adder = [&sum](int num) {
sum += num;
// compilation error, author didn't
// mean to capture diff.
diff -= num;
};
|
|