Hacker News new | past | comments | ask | show | jobs | submit login

I have been testing this, and I'm not convinced. A lambda with no capture at all (just []) will not compile if it accesses any variable in the scope of the lambda definition (including globals). I must add [=] or similar to get access to them. What were you referring to?

The compiler error is clear: "variable 'lam' cannot be implicitly captured in a lambda with no capture-default specified"





Indeed, I was noticing after my comment that the automatic access of globals is a different behavior than the access to other variables outside the lambda's scope, but not globals.

Thanks for the example.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: