fork download
  1. #include <memory>
  2. #include <future>
  3.  
  4. using namespace std;
  5.  
  6. template <typename T, typename Work>
  7. void Test2(future<T> f, Work w)
  8. {
  9. async([](future<T> && f, Work w)
  10. {}, move(f), move(w));
  11. }
  12.  
  13. int main()
  14. {
  15. future<int> x = std::async([]()->int{
  16. std::this_thread::sleep_for(std::chrono::microseconds(200));
  17. return 10;
  18. });
  19.  
  20. Test2(std::move(x), [](int x){});
  21. return 0;
  22. }
Success #stdin #stdout 0s 3044KB
stdin
Standard input is empty
stdout
Standard output is empty