fork download
  1. template<typename F>
  2. auto run_in_background(F && f) -> std::future<decltype(f())>
  3. {
  4. std::packaged_task<F> t(f); // doesn't compile, I think I need to decompose F into "Ret(Args...)" somehow.
  5. auto future = t.get_future();
  6. // ...
  7. return future;
  8. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:2:35: error: expected type-specifier
prog.cpp:2:35: error: expected initializer
stdout
Standard output is empty