fork(1) download
  1. #include <iostream>
  2. #include <functional>
  3.  
  4. using namespace std;
  5.  
  6.  
  7. void func() {
  8. cout << "Hello!" << endl;
  9. }
  10.  
  11. template<class F>
  12. void my_algorithm(F f) {
  13. int x = 100;
  14. int y = 200;
  15.  
  16. f(x, y);
  17. }
  18.  
  19.  
  20. int main() {
  21.  
  22. std::function<void(int, int)> func2 = std::bind(func);
  23. func2(100, 200);
  24. my_algorithm(func2);
  25.  
  26. return 0;
  27. }
Success #stdin #stdout 0s 3232KB
stdin
Standard input is empty
stdout
Hello!
Hello!