3 ms·
Full text of the tweet: > Oh great. ([](){})() is now legal C++. That's interesting, but what does it mean? I don't know enough about C++ to parse that expre
by reemrevnivek 15y ago
Full text of the tweet:
> Oh great. ([](){})() is now legal C++.
That's interesting, but what does it mean? I don't know enough about C++ to parse that expression.
More importantly, what coding styles or features do the syntax rules enable by allowing us to use that string of symbols? I don't use Twitter, but I think that Matthew missed an opportunity to write an interesting and useful article or blog post by expressing this through Twitter. He already has a number of other articles here: http://matt.might.net/articles/ http://matt.might.net/articles/
- nimbix 15y agoI'm also not a c++ programmer, but from what I've read so far I'd say the [](){} part is a lambda function which: [] - captures no vars () - accepts no parameters {} - has an empty body Wrapping it in (...)() immediately executes it.