fork(2) download
  1. #include <iostream>
  2. #include <functional>
  3.  
  4. using namespace std;
  5.  
  6. int caller(function<int(void*)> callback, void * arg = NULL) {
  7. return callback(arg);
  8. }
  9.  
  10. int main()
  11. {
  12.  
  13. const char *str = "world + dog";
  14. caller([&](void *arg) {
  15. printf("hello %s\n", str);
  16. return 0;
  17. }, NULL);
  18.  
  19. return 0;
  20.  
  21. }
  22.  
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
hello world + dog