From 1699a424e9d4476603b59a81ae8d530e927db5dc Mon Sep 17 00:00:00 2001 From: BobLiu Date: Thu, 5 Sep 2024 15:07:41 +0800 Subject: [PATCH] version 0.1 1 support c++2a. --- ThreadPool.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ThreadPool.h b/ThreadPool.h index 4183203..50764ac 100644 --- a/ThreadPool.h +++ b/ThreadPool.h @@ -10,13 +10,14 @@ #include #include #include +#include class ThreadPool { public: ThreadPool(size_t); template auto enqueue(F&& f, Args&&... args) - -> std::future::type>; + -> std::future::type>; ~ThreadPool(); private: // need to keep track of threads so we can join them @@ -61,9 +62,9 @@ inline ThreadPool::ThreadPool(size_t threads) // add new work item to the pool template auto ThreadPool::enqueue(F&& f, Args&&... args) - -> std::future::type> + -> std::future::type> { - using return_type = typename std::result_of::type; + using return_type = typename std::invoke_result::type; auto task = std::make_shared< std::packaged_task >( std::bind(std::forward(f), std::forward(args)...)