Can _Cilk_for iterate on STL maps?

Can _Cilk_for iterate on STL maps?


I have this loop iterating over a std::map:
for(std::map::const_iterator it = MyMap.begin(); it != MyMap.end(); it++)
No insertions/deletions are performer within the loop. Instead, values are just read from the tree as it is traversed.
1) Is random-access to elements and loop count computation at constant time mandatory?
2) Is it safe to use _Cilk_for on this loop?
2 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

Hi Jorge,

This kind of loop won't work with a cilk_for. You'll get the following compiler error:

 error: no operator "-" matches these operands

This is because cilk_for needs to be able to randomly access the container elements so it can dynamically split ranges in half as it spawns out work to be done in parallel.

Deixar um comentário

Faça login para adicionar um comentário. Não é membro? Inscreva-se hoje mesmo