Can you give me an example on tbb "parallel_for" without using lambda expression? Because I can't run lambda expression under Ubuntu system's C++ compiler, and I don't why. to be brief: turn this for loop into parallel_for please.
void print(int n)
{
cout<<n<<endl;
}
for(int i=0; i<100; i++)
{
print(i);
}
by the way, if who can tell me how to run C++ lambda expression in linux system, that would be better for me. Thanks.
Source
parallel_for will take any functor, which can be a lambda, a functor class or a plain old function; the following should work just fine too:
To use lambdas download gcc version 4.7 or later and give him option
-std=c++11