vit-vit / CTPL

Modern and efficient C++ Thread Pool Library
Apache License 2.0
1.79k stars 334 forks source link

Pushing lambdas to thread pool #15

Open RaghuDV15 opened 6 years ago

RaghuDV15 commented 6 years ago

TimerTask.cc: In lambda function: TimerTask.cc:93:38: error: no matching function for call to ‘ctpl::thread_pool::push(TimerTask::TimerTask()::lambda8::lambda10)’ pool.push( []() { sleep(10); }); ^ TimerTask.cc:93:38: note: candidates are: In file included from TimerTask.cc:16:0: ctpl.h:152:14: note: template<class F, class ... Rest> std::future<decltype (f(0, ctpl::thread_pool::push::rest ...))> ctpl::thread_pool::push(F&&, Rest&& ...) auto push(F && f, Rest&&... rest) ->std::future<decltype(f(0, rest...))> { ^ ctpl.h:152:14: note: template argument deduction/substitution failed: ctpl.h: In substitution of ‘template<class F, class ... Rest> std::future<decltype (f(0, ctpl::thread_pool::push::rest ...))> ctpl::thread_pool::push(F&&, Rest&& ...) [with F = TimerTask::TimerTask()::lambda8::lambda10; Rest = {}]’: TimerTask.cc:93:38: required from here ctpl.h:152:78: error: no match for call to ‘(TimerTask::TimerTask()::lambda8::lambda10) (int)’ auto push(F && f, Rest&&... rest) ->std::future<decltype(f(0, rest...))> { ^ TimerTask.cc:93:20: note: candidates are: pool.push( []() { sleep(10); }); ^ In file included from TimerTask.cc:16:0: ctpl.h:152:78: note: void ()() auto push(F && f, Rest&&... rest) ->std::future<decltype(f(0, rest...))> { ^ ctpl.h:152:78: note: candidate expects 1 argument, 2 provided TimerTask.cc:93:22: note: TimerTask::TimerTask()::lambda8::lambda10 pool.push( []() { sleep(10); }); ^ TimerTask.cc:93:22: note: candidate expects 0 arguments, 1 provided In file included from TimerTask.cc:16:0: ctpl.h:171:14: note: template std::future<decltype (f(0))> ctpl::thread_pool::push(F&&) auto push(F && f) ->std::future<decltype(f(0))> { ^ ctpl.h:171:14: note: template argument deduction/substitution failed: ctpl.h: In substitution of ‘template std::future<decltype (f(0))> ctpl::thread_pool::push(F&&) [with F = TimerTask::TimerTask()::lambda8::lambda10]’: TimerTask.cc:93:38: required from here ctpl.h:171:53: error: no match for call to ‘(TimerTask::TimerTask()::lambda8::lambda10) (int)’ auto push(F && f) ->std::future<decltype(f(0))> { ^ TimerTask.cc:93:20: note: candidates are: pool.push( []() { sleep(10); }); ^ In file included from TimerTask.cc:16:0: ctpl.h:171:53: note: void ()() auto push(F && f) ->std::future<decltype(f(0))> { ^ ctpl.h:171:53: note: candidate expects 1 argument, 2 provided TimerTask.cc:93:22: note: TimerTask::TimerTask()::lambda8::lambda10 pool.push( []() { sleep(10); }); ^ TimerTask.cc:93:22: note: candidate expects 0 arguments, 1 provided

ihowell commented 5 years ago

Care to provide source?