You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error C2672: "CTPL ::thread_pool::push" : no matching overloaded function found
Error C2780: "STD ::future : CTPL ::thread_pool::push(F &&)" : one parameter should be input, but two are provided
Error C2893: function template "STD ::future CTPL ::thread_pool::push(F &&,Rest &&...) "specialty
Error C2672: "STD ::vector< STD ::future, STD ::allocator<_Ty> : >::emplace_back" : overloaded function not found
ctpl::thread_pool p(8 /* two threads in the pool */);
std::vector< std::future<int> > results;
for (int i = 0; i < 8; ++i) {
results.emplace_back(
p.push(f, i));
}
for (auto && result : results)
std::cout << result.get() << ' ';
std::cout << std::endl;
getchar();
return 0;
}
The text was updated successfully, but these errors were encountered:
Hi I am new to CTPL too but I think that I have the answer to your question.
For functions to be pushed into thread_pool, there has to be an int argument as its first argument, the rest being the actual arguments needed by your function. So it translate to the following:
This seems to be applicable to all kinds of functions that you will passed into thread_pool, i.e. you need an int argument as the first argument, regardless of functor, function pointer, lambda, etc.
Error C2672: "CTPL ::thread_pool::push" : no matching overloaded function found
Error C2780: "STD ::future : CTPL ::thread_pool::push(F &&)" : one parameter should be input, but two are provided
Error C2893: function template "STD ::future CTPL ::thread_pool::push(F &&,Rest &&...) "specialty
Error C2672: "STD ::vector< STD ::future, STD ::allocator<_Ty> : >::emplace_back" : overloaded function not found
#include "ctpl_stl.h"
#include "iostream"
#include "string"
void f(int j)
{
std::cout << j << std::endl;
}
int main(int argc, char **argv) {
}
The text was updated successfully, but these errors were encountered: