fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. #include <boost/bind.hpp>
  5. #include <boost/function.hpp>
  6.  
  7. class FOO
  8. {
  9. public:
  10. void f(boost::function<void(int)> boostbind_, int i_)
  11. {
  12. boostbind_(i_);
  13. }
  14. };
  15.  
  16. class BOO
  17. {
  18. public:
  19. void b()
  20. {
  21. int i=0;
  22. auto t = boost::bind(&BOO::b2, this, _1);
  23. obj.f(t, i);
  24. }
  25. void b2(int) { cout << "test" << endl; }
  26. FOO obj;
  27. };
  28.  
  29. int main() {
  30. BOO b;
  31. b.b();
  32. return 0;
  33. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
test