Skip to content

Commit b3b9721

Browse files
committed
fix: Replace deprecated std::result_of with std::invoke_result
Remove trailing return type from enqueue; rely on C++14+ deduction. Reference: progschj/ThreadPool#130
1 parent 6a294b9 commit b3b9721

File tree

1 file changed

+3
-5
lines changed
  • third_party/com_github_progschj_threadpool/ThreadPool

1 file changed

+3
-5
lines changed

third_party/com_github_progschj_threadpool/ThreadPool/ThreadPool.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ class ThreadPool {
1616
public:
1717
ThreadPool(size_t);
1818
template <class F, class... Args>
19-
auto enqueue(F&& f, Args&&... args)
20-
-> std::future<typename std::result_of<F(Args...)>::type>;
19+
auto enqueue(F&& f, Args&&... args);
2120
~ThreadPool();
2221

2322
// Returns the thread ID.
@@ -69,9 +68,8 @@ inline ThreadPool::ThreadPool(size_t threads) : stop(false) {
6968

7069
// add new work item to the pool
7170
template <class F, class... Args>
72-
auto ThreadPool::enqueue(F&& f, Args&&... args)
73-
-> std::future<typename std::result_of<F(Args...)>::type> {
74-
using return_type = typename std::result_of<F(Args...)>::type;
71+
auto ThreadPool::enqueue(F&& f, Args&&... args) {
72+
using return_type = typename std::invoke_result<F, Args...>::type;
7573

7674
auto task = std::make_shared<std::packaged_task<return_type()> >(
7775
std::bind(std::forward<F>(f), std::forward<Args>(args)...));

0 commit comments

Comments
 (0)