I have this following code:
int main()
{
string s = "LOL";
auto f = [s](string s) // [=](string s) //****
{ cout << s << endl; };
f("WTF");
}
My question is about the line marked with //****.
In the first case (with [s]) the output is "LOL".
In the second case (with [=]) the output is "WTF".
I don't understand why.
I thought that [=] tells the lambda to capture all the scope's variables. Why is there a difference in the behavior?