title: What's the best way to iterate over two or more containers simultaneously
body: <p>C++11 provides multiple ways to iterate over containers. For example:</p>
  
  <h2>Range-based loop</h2>
  
  <pre><code>for(auto c : container) fun(c)
  </code></pre>
  
  <h2>std::for_each</h2>
  
  <pre><code>for_each(container.begin(),container.end(),fun)
  </code></pre>
  
  <p>However what is the recommended way to iterate over two (or more) containers of the same size to accomplish something like:</p>
  
  <pre><code>for(unsigned i = 0; i &lt; containerA.size(); ++i) {
    containerA[i] = containerB[i];
  }
  </code></pre>