I've encountered a notation like:
int x = 4;
auto y = [&r = x, x = x+1]()->int {
r += 2;
return x+2;
}();
Can you explain this statement? I was a user of C++03 and recently upgraded to C++11. From today I starts C++14 and encountered this snippet.
Thanks!
Thanks @chris for the wikipedia reference. What I found is -
Here is nice explanation who don't know about the old lambda Captures of C++11
In C++14:
So the above expression updates x to 6, and initializes y to 7.