loop for iterator openMP
<p>I use OpenMP to parallelize my code. I try to parallelize a loop for with two iterator. I would like to know if my implementation is the best way to parallelize this sequential code:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;omp.h&gt;

using namespace std;

int main(int argc, char *argv[])
{
  vector&lt;float&gt; v = {1, 2, 3, 4};
  vector&lt;float&gt; d = {0, 0, 0, 0};   
  vector&lt;float&gt;::iterator iterV, iterD; 

  for(iterV = v.begin(), iterD = d.begin(); iterV &lt; v.end(); ++iterV, ++iterD)
    {
      *iterD =  *iterV; 
    }


  for(iterD = d.begin(); iterD &lt; d.end(); ++iterD)
    cout &lt;&lt; *iterD &lt;&lt; endl;  

  return 0;
}
</code></pre>

<p>My parallel version of this code :</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;omp.h&gt;

using namespace std;

int main(int argc, char *argv[])
{
  vector&lt;float&gt; v = {1, 2, 3, 4};
  vector&lt;float&gt; d = {0, 0, 0, 0};   
  vector&lt;float&gt;::iterator iterV, iterD; 

  iterV = v.begin();
  iterD = d.begin();

 #pragma omp parallel for
  for(int i = 0; i &lt; v.size(); ++i)
    {
      *(iterD + i) =  *(iterV + i) ; 
    }


  for(iterD = d.begin(); iterD &lt; d.end(); ++iterD)
    cout &lt;&lt; *iterD &lt;&lt; endl;  

  return 0;
}`
</code></pre>