4 ms·
Not 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, nothi
by OskarS 6y ago
Not 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).