我正在使用tbb::parallel_for函数,它使用lambda表达式。以下代码出现语法错误:
void parallel_relax( Class object, std::vector<Vertex *> verList ) {
tbb::parallel_for (blocked_range<int>(0, verList.size()), [=](const blocked_range<Vertex *>& r) {
for(Vertex *vit = r.begin(); vit != r.end(); ++vit) {
Vertex *v = vit;
object.function(v);
}
});
}
语法错误:
syntax error : '['
1>main.cpp(16): error C2143: syntax error : missing ')' before '{'
1>main.cpp(16): error C2143: syntax error : missing ';' before '{'
1>main.cpp(17): error C2065: 'r' : undeclared identifier
1>main.cpp(17): error C2228: left of '.begin' must have class/struct/union
1> type is ''unknown-type''
1>main.cpp(17): error C2065: 'r' : undeclared identifier
1>main.cpp(17): error C2228: left of '.end' must have class/struct/union
1> type is ''unknown-type''
1>main.cpp(20): error C2059: syntax error : ')'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
我认为这是编译器的问题。我该如何在Visual Studio 2010 Express版中获取C++11编译器呢?请给予建议。