From ce416566727ab4078b46dd0013c384a0a6505613 Mon Sep 17 00:00:00 2001 From: Jan Niklas Hasse Date: Fri, 18 Jan 2019 10:50:55 +0100 Subject: [PATCH] Use C++14 feature: decltype(auto) See https://github.com/progschj/ThreadPool/pull/57 --- ThreadPool.hpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ThreadPool.hpp b/ThreadPool.hpp index 95773dc..3f34f02 100644 --- a/ThreadPool.hpp +++ b/ThreadPool.hpp @@ -9,8 +9,7 @@ class ThreadPool { public: explicit ThreadPool(size_t); template - auto enqueue(F&& f, Args&&... args) - -> std::future>; + decltype(auto) enqueue(F&& f, Args&&... args); ~ThreadPool(); private: // need to keep track of threads so we can join them @@ -54,8 +53,7 @@ inline ThreadPool::ThreadPool(size_t threads) // add new work item to the pool template -auto ThreadPool::enqueue(F&& f, Args&&... args) - -> std::future> +decltype(auto) ThreadPool::enqueue(F&& f, Args&&... args) { using return_type = std::invoke_result_t;