From fd388777b83865999dd415a5ea80dfb3586a034b Mon Sep 17 00:00:00 2001 From: hopenobug Date: Sun, 26 Mar 2023 17:02:30 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81C++20=E7=BC=96?= =?UTF-8?q?=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/UtilsCtrl/ThreadPool/UThreadPool.h | 4 ++-- src/UtilsCtrl/ThreadPool/UThreadPool.inl | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/UtilsCtrl/ThreadPool/UThreadPool.h b/src/UtilsCtrl/ThreadPool/UThreadPool.h index ce0d6b6..3783630 100644 --- a/src/UtilsCtrl/ThreadPool/UThreadPool.h +++ b/src/UtilsCtrl/ThreadPool/UThreadPool.h @@ -65,7 +65,7 @@ public: template auto commit(const FunctionType& func, CIndex index = CGRAPH_DEFAULT_TASK_STRATEGY) - -> std::future::type>; + -> std::future()())>; /** * 根据优先级,执行任务 @@ -78,7 +78,7 @@ public: template auto commitWithPriority(const FunctionType& func, int priority) - -> std::future::type>; + -> std::future()())>; /** * 执行任务组信息 diff --git a/src/UtilsCtrl/ThreadPool/UThreadPool.inl b/src/UtilsCtrl/ThreadPool/UThreadPool.inl index 61f749c..7485df7 100644 --- a/src/UtilsCtrl/ThreadPool/UThreadPool.inl +++ b/src/UtilsCtrl/ThreadPool/UThreadPool.inl @@ -15,8 +15,8 @@ CGRAPH_NAMESPACE_BEGIN template auto UThreadPool::commit(const FunctionType& func, CIndex index) --> std::future::type> { - using ResultType = typename std::result_of::type; +-> std::future()())> { + using ResultType = decltype(std::declval()()); std::packaged_task task(func); std::future result(task.get_future()); @@ -43,8 +43,8 @@ auto UThreadPool::commit(const FunctionType& func, CIndex index) template auto UThreadPool::commitWithPriority(const FunctionType& func, int priority) --> std::future::type> { - using ResultType = typename std::result_of::type; +-> std::future()())> { + using ResultType = decltype(std::declval()()); std::packaged_task task(func); std::future result(task.get_future());