| 66 | |
| 67 | template <typename F> |
| 68 | std::future<std::invoke_result_t<F>> ObsoleteSpawnTask(F f) { |
| 69 | typedef std::invoke_result_t<F> result_type; |
| 70 | typedef std::packaged_task<result_type()> task_type; |
| 71 | |
| 72 | task_type task(std::move(f)); |
| 73 | std::future<result_type> result = task.get_future(); |
| 74 | |
| 75 | std::vector<std::function<void()>> vec; |
| 76 | vec.push_back(g3::MoveOnCopy<task_type>(std::move(task))); |
| 77 | std::thread(std::move(vec.back())).detach(); |
| 78 | result.wait(); |
| 79 | return std::move(result); |
| 80 | } |
| 81 | |
| 82 | TEST(TestOf_ObsoleteSpawnTaskWithStringReturn, Expecting_FutureString) { |
| 83 | std::string str("Hello"); |