我在使用Boost的线程中使用lambda问题。boost :: lambda with boost :: thread
该代码应该将函数(字符串)的结果放在向量的指定索引中。
std::vector<string> results(size);
std::vector<boost::thread> threads;
for( int i = 0; i < size; i++) {
threads.push_back(boost::thread(results.at(i) = getAString(x,y,zed)));
}
我该如何去使用Boost :: lambda?
请不要提及使用C++ 11语法。我不得不使用的系统不支持支持C++ 11的编译器。谢谢!
我最终将lambda重写为boost :: thread的类扩展,并带上了results.at(i),正如您所提到的。肯定帮了很多,谢谢! –