Skip to content

Instantly share code, notes, and snippets.

@redforce01
Created March 22, 2017 23:27
for my blog gist - lambda code #11
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