Skip to content

Commit ce41656

Browse files
committed
Use C++14 feature: decltype(auto)
See progschj#57
1 parent 467d2f4 commit ce41656

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

ThreadPool.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ class ThreadPool {
99
public:
1010
explicit ThreadPool(size_t);
1111
template<class F, class... Args>
12-
auto enqueue(F&& f, Args&&... args)
13-
-> std::future<std::invoke_result_t<F, Args...>>;
12+
decltype(auto) enqueue(F&& f, Args&&... args);
1413
~ThreadPool();
1514
private:
1615
// need to keep track of threads so we can join them
@@ -54,8 +53,7 @@ inline ThreadPool::ThreadPool(size_t threads)
5453

5554
// add new work item to the pool
5655
template<class F, class... Args>
57-
auto ThreadPool::enqueue(F&& f, Args&&... args)
58-
-> std::future<std::invoke_result_t<F, Args...>>
56+
decltype(auto) ThreadPool::enqueue(F&& f, Args&&... args)
5957
{
6058
using return_type = std::invoke_result_t<F, Args...>;
6159

0 commit comments

Comments
 (0)