What's the difference between
[&](){x;} and
[&x](){x;} ?
In this particular embodiment, essentially nothing. Just in the first case, the capture of all variables by reference occurs, and in the second, the specific one. But since nothing in the body except x is used, there is no difference. Especially when optimizing the code :) - they will most likely just be removed altogether.
VC ++ 2015 did exactly that - threw it away at all during optimization, and without it, generated two absolutely identical codes.
Source: https://ru.stackoverflow.com/questions/510206/
All Articles
xis a macro, then the difference can be arbitrarily big :) - VladD