Created
March 22, 2017 23:27
for my blog gist - lambda code #11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main() | |
{ | |
int x = 100; | |
[=]() { std::cout << x << std::endl; } (); // print x = 100 | |
[=]() mutable { std::cout << x << std::endl; // print x = 100 | |
x = 200; }(); // x = 200 | |
std::cout << x << std::endl; // print x = 100 | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment