3 ms·
That's an interesting point, and very C-like. You're right that capture-by-value can emulate capture-by-reference. Capture-by-value does have a weakness though
by nrclark 5y ago
That's an interesting point, and very C-like. You're right that capture-by-value can emulate capture-by-reference.
Capture-by-value does have a weakness though, in that it requires allocation (whether stack or heap). Capture-by-reference doesn't have any storage overhead.
In my example, I suggested having both. But if we had to pick only one, capture-by-value would be the one to use.