lambda expression error: expression must be a modifiable lvalue

Ok, the codes are:
1
2
3
4
5
6
7
8
9
10
11
12
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
            }
        }
});

And I've write another similar code block which works just fine. So, a little help here.
PS: parallel_for is from Interl TBB.
You are trying to change data member of lambda-expression while the lambda-expression has no specifier mutable

imageFiltered[i][j] = 0;
I've never use the lambda expression before. Could you be more specific, please?
So I read the lambda expression syntax, and change the [=] to [&], now it's perfect.
Topic archived. No new replies allowed.