????C++11??????lambda????????ó??????????????????????ú????????????е???????????????????????????
????Lambda?????????????????????

??????????????????????????????lambda??????????????????б??б???????????????????
????Lambda????????????????‘[]’???????????‘=’??‘&’?????lambda????“????”??lambda??????????? scope?????????????????????????????????‘&’?????????????‘=’??????????????????????????????
????Lambda???????????б?
????Mutable ???
?????????
?????????
????“????”?壬???lambda??????????е???????
????????????????β?????????
????int x = 10;
????int y = 3;
????int z ;
????z = [=]()mutable throw() -> int { int n = x + y; x = y ; y = n; return n;}();
????cout<<z<<endl;
????cout<<"x:"<<x<<" "<<"y:"<<y<<endl;
???????н?????
????13
????x: 10  y: 3
???????????????????????x??y????x??y???????з??????
?????????????lambda?????????????????Щ???????????????????
???????????????????????lambda???????洫???????
#include <iostream>
using namespace std;
int main()
{
int n = [] (int x?? int y) { return x + y; }(5?? 4);
cout << n << endl;
}
???????н?????9
?????????????????????????????“??????”?????‘()’?????????
?????????????????????????????????ú?????????lambda??????????о?????????????????????????ò?????????????????÷???????
#include <iostream>
using namespace std;
int main()
{
auto f = [] (int x?? int y) { return x + y; };
cout << f(21?? 12) << endl;
}
???????н?????33