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