How can I store generic packaged_tasks in a container?
问题 I'm trying to take a 'task' in the style of std::async and store it in a container. I'm having to jump through hoops to achieve it, but I think there must be a better way. std::vector<std::function<void()>> mTasks; template<class F, class... Args> std::future<typename std::result_of<typename std::decay<F>::type(typename std::decay<Args>::type...)>::type> push(F&& f, Args&&... args) { auto func = std::make_shared<std::packaged_task<typename std::result_of<typename std::decay<F>::type(typename