Using OpenMP with C++11 range-based for loops?

c++11, openmp

Solution

OpenMP 5.0 adds the following line on page 99, which makes a lot of range-based for loops OK !

2.12.1.3 A range-based for loop with random access iterator has a canonical loop form.

Source : https://www.openmp.org/wp-content/uploads/OpenMP-API-Specification-5.0.pdf

Problem

Is there any counter-indication to doing this ? Or is the behavior well specified? ``` #pragma omp parallel for for(auto x : stl_container) { ... } ``` Because it seems that OpenMP specification is only valid for c++98 but I guess there might be more incompatibilities due to C++11 threads, which are not used here. I wanted to be sure, still.

Original source