#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的指定参数上,并且数量不定

相关文章:

  • 2021-08-27
  • 2021-07-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-20
  • 2022-01-26
猜你喜欢
  • 2021-05-21
  • 2021-10-06
  • 2021-06-13
  • 2021-12-22
  • 2022-12-23
  • 2022-03-05
相关资源
相似解决方案