Consider the following example:
int main() { int a = 100; std::cout<<[=,&a](int a,int b){return a+b;}(99,1); return 0; }
Conclusion 101 instead of my expectation of 100 .
I canβt indicate like this [&a,=] , because it gives an error.
How to avoid hiding the name and link to the parameter. I know that changing the name is an option, but I'm curious. it will also be useful to refer to the standard
EDIT: I am using gcc 4.7.1
EDIT:
here is the ideone link showing the demo. i used c ++ 4.7.2 complier there
ideone
c ++ c ++ 11
Koushik shetty
source share