title: Advantage of computing map.end() outside the loop
body: <p>I recently came across the following code. </p>
  
  <pre><code>std::map&lt;int, int&gt; m;
  
  // insert into the map
  
  std::map&lt;int, int&gt;::iterator endOfMap = m.end();
  for(std::map&lt;int, int&gt;::iterator itr = m.begin(); itr != endOfMap; ++itr) {
  
  }
  </code></pre>
  
  <p>Is there any advantage of computing endOfMap beforehand over the below? </p>
  
  <pre><code>for(std::map&lt;int, int&gt;::iterator itr = m.begin(); itr != m.end(); ++itr) 
  </code></pre>
  
  <p><strong>Note: <br></strong>
  The code I saw was a map of string to custom object, with millions of elements. </p>