• 使用boost function使用类成员函数作为回调函数
#include <iostream>  
#include <boost/function.hpp>
struct MyTest { int foo(int a){ return a;}; }; int main(int argc, char *argv[]) { boost::function<int (int)> cb; X x; cb = std::bind1st(std::mem_fun(&X::foo), &x); std::cout<<cb(5)<<std::endl; return 0; }

 

相关文章:

  • 2021-11-25
  • 2022-12-23
  • 2022-02-13
  • 2021-10-28
  • 2021-05-10
  • 2022-02-14
  • 2021-07-09
  • 2021-08-12
猜你喜欢
  • 2022-02-04
  • 2021-08-07
  • 2021-12-21
  • 2021-06-22
  • 2021-06-20
  • 2021-06-19
相关资源
相似解决方案