function对象,头文件functional
//lamda只能是auto才可以;
int main(int argc, char** argv)
{
auto fun = [](const int a, const int b) {return a + b; };
std::function<int(int, int)> func = fun;
fun(1, 2);
return 0;
}
//lamda只能是auto才可以;
int main(int argc, char** argv)
{
auto fun = [](const int a, const int b) {return a + b; };
std::function<int(int, int)> func = fun;
fun(1, 2);
return 0;
}
相关推荐