3 ms·
In the first example, there is nothing inside the lambdas, doesnt that mean that _nothing_ will be captured? ie: including `this`?
by nightowl_games 6y ago
In the first example, there is nothing inside the lambdas, doesnt that mean that _nothing_ will be captured? ie: including `this`?
- OskarS 6y agoNot quite sure what example you're referring to, but you mean if you do a lambda like this? auto add = [](int x, int y) { return x + y; }; Then yes, nothing will be captured. This is a pure function lambda. It's essentially just a convenient way to create a function pointer, and will in fact implicitly convert to a C function pointer. This is very useful with C libraries that use function pointers as callbacks (they usually provide the "this" equivalent as an argument instead of a capture).