Can _Cilk_for iterate on STL maps?

Can _Cilk_for iterate on STL maps?

Hi!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?Thanks!

2 post / 0 nuovi
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione

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.

Brandon Hewitt Technical Consulting Engineer For 1:1 technical support: http://premier.intel.com Software Product Support info: http://www.intel.com/software/support

Lascia un commento

Eseguire l'accesso per aggiungere un commento. Non siete membri? Iscriviti oggi