parallel_for
has the prototype
template <typename T, typename F>
void parallel_for(
T first,
T last,
F& f,
const auto_partitioner& _Part = auto_partitioner()
);
T
is deduced from first
and last
but you're giving it size_t
and int
making T
ambiguous.
Also, there are other overloaded functions parallel_for
and MSVC generates a stupid error message in such case.
Solution 1 :
int _tmain(int argc, _TCHAR* argv[])
{
parallel_for(size_t(0), size_t(50), [&](size_t i)
{
cout << i << ",";
});
cout << endl;
getchar();
return 0;
}
Solution 2 :
parallel_for<size_t>(size_t(0), 50, [&](size_t i)
{
cout << i << ",";
});