fork download
  1. #include <thread>
  2. #include <future>
  3. #include <string>
  4.  
  5. struct arg_t {
  6. std::string fName;
  7. std::string str;
  8. };
  9.  
  10. int startOver(int i, arg_t args)
  11. {
  12. return args.fName.size() + args.str.size() + 42;
  13. }
  14.  
  15. int main()
  16. {
  17. const std::string arg = "yes";
  18. arg_t args = { "comBomber", arg };
  19. auto worker = std::async(startOver, 0, args);
  20. return worker.get();
  21. }
  22.  
Runtime error #stdin #stdout 0s 3080KB
stdin
Standard input is empty
stdout
Standard output is empty