求教TBB。vs2008+TBB4.0 容器的使用。

mhm0902 2011-10-08 04:25:17
我用tbb::concurrent_vector及parallel_for多线程,源码如下

void operator( )( const tbb::blocked_range<int>& range ) const
{

for( int i=range.begin(); i!=range.end( ); ++i )
{
if (status[i] == 1)
{
outpoints[i].x = 20;

}
else
{
outpoints[i].x = 0;
}

}
}

其中:tbb::concurrent_vector<Point> outpoints
当编译时报如下错误:
Error 1 error C3892: 'i' : you cannot assign to a variable that is const
...全文
121 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
uncle_bacon 2011-10-10
  • 打赏
  • 举报
回复
路过学习了
mhm0902 2011-10-10
  • 打赏
  • 举报
回复
问题解决了,在循环中用指针才行。
intel_zhenyuwang 2011-10-09
  • 打赏
  • 举报
回复
好像用的不对吧。哪有对outpoints直接操作的。
学习一下字符串的处理例子吧,经典
tbb\examples\concurrent_hash_map\count_strings
mhm0902 2011-10-08
  • 打赏
  • 举报
回复
请教一下,我应该发哪个区。谢谢!
Acesidonu 2011-10-08
  • 打赏
  • 举报
回复
发错地了吧

567

社区成员

发帖
与我相关
我的任务
社区描述
英特尔® 边缘计算,聚焦于边缘计算、AI、IoT等领域,为开发者提供丰富的开发资源、创新技术、解决方案与行业活动。
社区管理员
  • 英特尔技术社区
  • shere_lin
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧