From 272b5c1238ddab94452e6861a399b1a8bc97cffa Mon Sep 17 00:00:00 2001 From: rexy712 Date: Sun, 26 Jun 2022 14:56:24 -0700 Subject: [PATCH] Use invoke_result_t in threadpool --- include/rexy/threadpool.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/rexy/threadpool.hpp b/include/rexy/threadpool.hpp index 70ba8f8..130a02f 100644 --- a/include/rexy/threadpool.hpp +++ b/include/rexy/threadpool.hpp @@ -1,6 +1,6 @@ /** This file is a part of rexy's general purpose library - Copyright (C) 2020 rexy712 + Copyright (C) 2020-2022 rexy712 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,6 +29,7 @@ #include //future, packaged_task #include //function, bind #include //move, forward +#include //invoke_result_t #include "rexy.hpp" @@ -62,14 +63,14 @@ namespace rexy{ void invalidate(void); template - auto add_job(Func&& f, Args&&... args) -> std::future(f)(std::forward(args)...))>; + auto add_job(Func&& f, Args&&... args) -> std::future>; private: void worker_loop(void); }; template - auto threadpool::add_job(Func&& f, Args&&... args) -> std::future(f)(std::forward(args)...))>{ + auto threadpool::add_job(Func&& f, Args&&... args) -> std::future>{ using return_t = decltype(std::forward(f)(std::forward(args)...)); using task_t = std::packaged_task;