3 ms·
Not sure I like implicit capture more than explicit capture but there's [=] if you need it. Also, the return value as the article mentions is optional, so most
by noobermin 6y ago
Not sure I like implicit capture more than explicit capture but there's [=] if you need it. Also, the return value as the article mentions is optional, so most lambdas look like
const auto nestedfunc = [=](a,b) { /* */ };
Which isn't that much different to me than
{ /* some scope */
function nestedfunc(a,b) { /* */ }
}
const and auto are needed but because it's C++. Beyond that, you have an equals sign which is needed here but [=] which is three characters. Again, small differences, not sure why it looks that much worse.
- rightbyte 6y agoNow that we know lambdas they are fine, but to answer the question "why is there a book" in the beginning of the thread, it is more or less because it is not as obvious as gcc's c extension.
- CyberDildonics 6y agoWhat is so cryptic that there needs to be a separate syntax change? auto triple = [](auto x){ return 3 * x; };
- rightbyte 6y agoYe well nothing when we have already are to lambdas.