好的,代码是:
vector<vector<double>> imageFiltered;
// some processing codes here
parallel_for( blocked_range<unsigned>(0, imageFiltered.size()),
[=](const blocked_range<unsigned>& r) {
for( unsigned i = r.begin(); i != r.end(); ++i ){
for( unsigned j = 0; j != imageFiltered[i].size(); ++j ) {
imageFiltered[i][j] = 0; // error here:expression must be a modifiable lvalue
}
}
});
而且我编写了另一个类似的代码块,它工作得很好。所以,这里有点帮助。PS:parallel_for 来自 Interl TBB。