In a sequential for
loop, the current iteration can be interrupted by calling continue
. Similarly, in a Concurrency::parallel_for
loop, the current iteration - which is a thread calling a lambda function - can be interrupted with return
.
From time to time, it happens that I have to debug a parallel_for
loop, make it sequential and forget to change the return
into a continue
, because in a void
function, the compiler won't complain. This leads to errors that are really hard to track down sometimes.
I wonder if Visual C++ 2013 offers any mechanism to use the same keyword/macro/… for both loops. Is this possible?
Aucun commentaire:
Enregistrer un commentaire