I'm using Intel Parallel Studio SP1 within Visual Studio 2008 and cannot get the compiler (v. 11.1.071 [IA-32]) to recognize the lambda expression within a TBB parallel_for. Using several different documentation resources, I've settled on the following code (for matrix multiplication):
parallel_for(blocked_range(0, m, 1),
[=](const blocked_range& r){ // use lambda facility of TBB 3.0
for (size_t i = r.begin(); i < r.end(); i++)
for (int j = 0; j < n; j++){
C[i][j]=0;
for (int k = 0; k < p; k++)
C[i][j] += A[i][k]*B[k][j];
}
}, auto_partitioner());
I keep getting a compiler error ".\\MMmult.cpp(36): error: expected an expression" pointing to the open square bracket of the lambda. I've tried without the '=' and putting the lambda in a separate declaration (as was pointed out in an earlier forum post). All with the same negative results.
Any advice on what I'm doing wrong or what might be missing?
--clay


