#include<iostream>
#include<functional>
using namespace std;
int fun(int n)
{
cout << n << endl;
return n;
}
int main()
{
/*函数对象包装器--头文件<functional>*/
//为函数提供了一种容器(封装)
//普通函数
std::function<int(int)> f = fun;
f(1);
//匿名函数
std::function<int(int)> f1 = [](int n)->int {
cout << n << endl;
return n;
};
f1(2);
}