title: OpenMP and STL vector
body: <p>I've got some code for which I'd like to use OpenMP in the following way:</p>
  
  <pre><code>std::vector&lt;int&gt; v(1000);
  # pragma omp parallel for
  for (int i = 0; i &lt; 1000; ++i) {
      v[i] = i;
  }
  </code></pre>
  
  <p>I have read that STL vector container is not thread-safe in the situation where multiple threads write to a single container, which would imply that I'd need to lock the vector before making any writes; however, I've also been told that the write operation above is somehow "atomic", and so there is no race condition above.  Could someone clarify this?</p>