Reputation: 725
I am trying to run a code snippet using openmp, but it gives compile error as there is no initialization in the for
loop. The iterator class
is defined here. I am not able to figure out how can I initialize inside the for
loop.
I am not an expert in C++, so I would appreciate any help.
ntHashIterator itr(seq, h, k);
#pragma omp parallel for
for(; itr != itr.end(); ++itr){
std::cout << (*itr)[0] << std::endl;
}
Upvotes: 0
Views: 609
Reputation: 23547
OpenMP requires loops to be in so-called canonical loop form. Moreover, it can works with iterators, but they have to be of a random-access iterator type. Which doesn't seem to be your case, since your nHashIterator
does not support +
and +=
operators. See the OpenMP specifications for more details.
Anyway, it's hard to tell more, since you are not providing enough details such as a compiler and OpenMP version which it supports.
Upvotes: 2