title: C++ for loop and range-based loop performance
body: <p>I read that range-based loops have better performance on some programming language. Is it the case in C++.
  For instance;</p>
  
  <pre><code>int main()
  {
      vector&lt;int&gt; v = {1, 2, 3, 4, 5};
  
      auto size = v.size();
      // LOOP1
      for (int i = 0; i &lt; size; i++) {
          // do something with v[i]
      }
  
      // LOOP2    
      for (int&amp; val : v) {
          // do something with val 
      }
  
      return 0;
  }
  </code></pre>
  
  <p>Does <code>LOOP2</code> perform better than <code>LOOP1</code> when <code>vector</code> size is huge? If so, why?</p>