fork download
  1. #include <cstdlib>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <thread>
  5. #include <future>
  6.  
  7. int main()
  8. {
  9. std::vector<int> v(1ul<<27);
  10.  
  11. auto f(begin(v)), m(f+v.size()/2), l(end(v));
  12. std::generate(f, l, rand);
  13.  
  14. #if 0
  15. auto t1 = std::thread([&] () mutable { std::sort(f,m); } );
  16. auto t2 = std::thread([&] () mutable { std::sort(m,l); } );
  17. t1.join();
  18. t2.join();
  19. #else
  20. auto f1 = std::async(std::launch::async, [&] () mutable { std::sort(f,m); } );
  21. auto f2 = std::async(std::launch::async, [&] () mutable { std::sort(m,l); } );
  22. f1.get();
  23. f2.get();
  24. #endif
  25.  
  26. std::inplace_merge(f,m,l);
  27. }
  28.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(2,0): error CS1024: Wrong preprocessor directive
prog.cs(3,0): error CS1024: Wrong preprocessor directive
prog.cs(4,0): error CS1024: Wrong preprocessor directive
prog.cs(5,0): error CS1024: Wrong preprocessor directive
prog.cs(6,0): error CS1024: Wrong preprocessor directive
prog.cs(7,0): error CS1525: Unexpected symbol `int'
prog.cs(15,0): error CS1517: Invalid preprocessor directive
prog.cs(15,0): error CS1025: Single-line comment or end-of-line expected
prog.cs(20,47): warning CS0658: `<operator>' is invalid attribute target. All attributes in this attribute section will be ignored
prog.cs(28,1): error CS8025: Parsing error
Compilation failed: 9 error(s), 1 warnings
stdout
Standard output is empty