fork(1) download
  1. #include <iostream>
  2. #include <functional>
  3.  
  4. void foo() { std::cout << "hello world" << std::endl; }
  5.  
  6. void foo2(int a) { std::cout << "hello friend number " << a << std::endl; }
  7.  
  8. int main()
  9. {
  10. std::function<void()> functions[] = {
  11. foo,
  12. std::bind( foo2, 1 )
  13. };
  14.  
  15. for( auto f : functions ) f();
  16. }
  17.  
Success #stdin #stdout 0s 4148KB
stdin
Standard input is empty
stdout
hello world
hello friend number 1