fenbf / cppstories-discussions

4 stars 1 forks source link

2019/03/lambdas-story-part2/ #39

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

Lambdas: From C++11 to C++20, Part 2 - C++ Stories

In the first part of the series we looked at lambdas from the perspective of C++03, C++11 and C++14. In that article, I described the motivation behind this powerful C++ feature, basic usage, syntax and improvements in each of the language standards. I also mentioned several corner cases. Now it’s time to move into C++17 and look a bit into the future (very near future!

https://www.cppstories.com/2019/03/lambdas-story-part2/

nickhuang99 commented 3 years ago

In the above example about "no-need-capture-if-constexpr", there is one missing ";" at end of return statement before "}". I thought it is trivial, but it would be nice to pass compilation for all examples.

constexpr int x = 0; constexpr auto lam = [x](int n) { return n + x ; };