Skip to content

Commit bb53041

Browse files
committed
Fix
1 parent 5cb6e39 commit bb53041

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

include/MGIS/ThreadPool.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ namespace mgis {
4848
* \param[in] a: arguments passed to the the task
4949
*/
5050
template <typename F, typename... Args>
51-
std::future<ThreadedTaskResult<typename std::invoke_result<F(Args...)>::type>>
51+
std::future<ThreadedTaskResult<std::invoke_result_t<F, Args...>>>
5252
addTask(F&&, Args&&...);
5353
//! \return the number of threads managed by the ppol
5454
size_type getNumberOfThreads() const;

include/MGIS/ThreadPool.ixx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ namespace mgis {
2424
struct ThreadPool::Wrapper {
2525
Wrapper(F&& f_) : f(f_) {}
2626
template <typename... Args>
27-
ThreadedTaskResult<typename std::invoke_result<F(Args...)>::type> operator()(
27+
ThreadedTaskResult<std::invoke_result_t<F, Args...>> operator()(
2828
Args&&... args) {
29-
using result = typename std::invoke_result<F(Args...)>::type;
30-
using apply = typename std::conditional<std::is_same<result, void>::value,
31-
GetVoid, Get<result>>::type;
29+
using result = std::invoke_result_t<F, Args...>;
30+
using apply = std::conditional_t<std::is_same_v<result, void>, GetVoid,
31+
Get<result>>;
3232
ThreadedTaskResult<result> r;
3333
apply::exe(r, f, std::forward<Args>(args)...);
3434
return r;
@@ -61,10 +61,9 @@ namespace mgis {
6161

6262
// add new work item to the pool
6363
template <typename F, typename... Args>
64-
std::future<ThreadedTaskResult<typename std::invoke_result<F(Args...)>::type>>
64+
std::future<ThreadedTaskResult<std::invoke_result_t<F, Args...>>>
6565
ThreadPool::addTask(F&& f, Args&&... a) {
66-
using return_type =
67-
ThreadedTaskResult<typename std::invoke_result<F(Args...)>::type>;
66+
using return_type = ThreadedTaskResult<std::invoke_result_t<F, Args...>>;
6867
using task = std::packaged_task<return_type()>;
6968
auto t = std::make_shared<task>(
7069
std::bind(Wrapper<F>(std::forward<F>(f)), std::forward<Args>(a)...));

0 commit comments

Comments
 (0)