问题描述
|
尝试以下代码时:
Concurrency::concurrent_vector<int> results_temp;
std::set<int > temp;
Concurrency::parallel_for_each(temp.begin(),temp.end(),[&](int p) {
results_temp.push_back(p);
});
我收到以下编译时错误:
1>C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\include\\ppl.h(2081): error C2440: \'=\' : cannot convert from \'const int *\' to \'int *\'
我设法使parallel_for_each与std::deque<>
,std::list<>
,std::vector<>
和std::map<>
一起使用。
我很好奇如何使它在ѭ6上工作,或者为什么不支持它。
解决方法
示例代码对我来说没有错误。
我添加了以下内容:
#include <ppl.h>
#include <concurrent_vector.h>
是否安装了SP1?
,如果出于某种原因没有Concurrency::concurrent_set
,则一定要使用
Concurrency::concurrent_map<T,unused_type>
理想情况下,将以这样的方式填充“ 10”,以使“ 11”可以实现空基类优化。测试并分析。如果是这样,那么您就完成了。
两四件事
我知道这只是slightly脚
假设“ 12”具有“ 13”语义
次要假设“ 12”使用对
我实际上并没有使用PPL(我在并行模式下使用GNU libgomp)