https://www.cnblogs.com/jimodetiantang/p/9016826.html
https://blog.csdn.net/a262624/article/details/87904329
#include<iostream>
#include<memory>
#include<algorithm>
#include<vector>
using namespace std;
/*int main()
{
vector<int> a{ 1, 3, 5, 6, 2 };
sort(a.begin(), a.end(), [](int a, int b){return a > b; });
for (int it : a)
cout << it << ' ';
system("pause");
}*/
/*int main()
{
int a = 2;
auto f = [=](int x)->int{return x + 2; };
cout << f(4) << endl;
system("pause");
}*/
int main()
{
int a = 1; int b = 2;
auto f = [&](int x)->int{return x + a + b; };
a = 2, b = 3;
cout<<f(4)<<endl;
system("pause"); ///输出为9
}