#include <functional> #include <string> #include <iostream> using namespace std; void funa(int arg1, string arg2) { cout << arg1 << arg2 <<endl; } int main() { std::function<void(int arg1, string arg2, string arg3)> fun; fun = std::bind(&funa, std::placeholders::_1, std::placeholders::_3); fun(1, "123", "124"); getchar(); return 0; }
可以将函数绑定到function的指定参数上,并且数量不定