fork download
  1. #include <functional>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. class C {
  7. public:
  8. C() {
  9. function<bool()> a = std::bind(&C::step1, this), b = std::bind(&C::step2, this);
  10. auto f = bind(&C::work, this, a, b);
  11.  
  12. f();
  13. }
  14. private:
  15. void work(function<bool()> fn1, function<bool()> fn2) {
  16. cout << fn1() << ' ' << fn2() << endl;
  17. }
  18.  
  19. bool step1() { return true; }
  20. bool step2() { return true; }
  21. };
  22.  
  23. int main() {
  24. C foo;
  25. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
1 1