tbb lambdar函数编译出错?
tbb2.2应该支持lambdar函数吧,
parallel_for(blocked_range<int>(0, num_steps, 5000),
[] (const blocked_range<int> &r) {
for (int i = r.begin(); i != r.end(); ++i){
x = (i + 0.5)*step;
sum = sum + 4.0/(1. + x*x);
}
tbb::spin_mutex::scoped_lock lock(myMutex);
pi += step *sum;
});
intel 编译器和vc++编译器怎么都是这个错误啊,请教了?我是在vs2005下
error: expected an expression [] (const blocked_range<int> &r) {
怎么有的书上说应该是
<> (const blocked_range<int> &r) {
lambdar函数应该是[]还是<>啊?