progschj / ThreadPool

A simple C++11 Thread Pool implementation
zlib License
7.63k stars 2.21k forks source link

support c++17 and c++20 #105

Open MatchX opened 1 year ago

MatchX commented 1 year ago

https://github.com/MatchX/cpp_threadpool

AmanjitPREA commented 6 months ago

As @MatchX already mentioned...

#include <type_traits> ... decltype( auto ) enqueue( F&& f, Args&& ... args ); ... decltype( auto ) ThreadPool::enqueue( F&& f, Args&& ... args ) { using return_type = std::invoke_result_t<std::decay_t<F>, std::decay_t<Args>...>;

seems to do the trick