开发者

OpenMP - Iterator in the For-loop

#pragma omp parallel for reduction(+ : numOfVecs)
for(itc=clus.begin() ; itc!=clus.end() ; itc++)
{
    numOfVecs += (*itc)->getNumOfVecs();

}

I have a couple of codes like the code above where I need iterators in the loop. But I get the error 'invalid controlling predicate'. Is there any way to overcome this?

Thanks in advance


By the way I'm using the latest versions of code::blocks and mingw. I'm new to this but I think they support openmp3.0 by default after -fopenmp. The iterator I'm us开发者_开发问答ing is list iterator.


std::list<T>::iterator is a bidirectional iterator. Afaik, openmp3 parallel for loop works with random access iterators only (and no !=, as ejd mentioned). Maybe you can use a std::vector instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜