diff --git a/ThreadPool.h b/ThreadPool.h index fbce416..bf639a3 100644 --- a/ThreadPool.h +++ b/ThreadPool.h @@ -16,7 +16,7 @@ class ThreadPool { ThreadPool(size_t); template auto enqueue(F&& f, Args&&... args) - -> std::future(f)(std::forward(args)...))>; + -> std::future::type>; ~ThreadPool(); private: // need to keep track of threads so we can join them @@ -35,7 +35,7 @@ inline ThreadPool::ThreadPool(size_t threads) : stop(false) { for(size_t i = 0;i auto ThreadPool::enqueue(F&& f, Args&&... args) - -> std::future(f)(std::forward(args)...))> + -> std::future::type> { - typedef decltype(std::forward(f)(std::forward(args)...)) return_type; + typedef typename std::result_of::type return_type; // don't allow enqueueing after stopping the pool if(stop)