title: std::map insert() hint location: difference between c++98 and c++11
body: <p>On <a href="http://www.cplusplus.com/reference/map/map/insert/">cplusplus' entry on map::insert()</a> I read about the location one could add as a hint for the function that the "function optimizes its insertion time if <code>position</code> points to the element that will <strong>precede</strong> the inserted element" for c++98, while for c++11 the optimization occurs "if <code>position</code> points to the element that will <strong>follow</strong> the inserted element (or to the end, if it would be the last)".</p>
  
  <p>Does this mean that the performance of code snippets of the following form (which are abundant in the legacy code I'm working on and modeled after <a href="http://www.aristeia.com/">Scott Meyer</a>'s "Effective STL", item 24) were affected in switching to a C++11-compliant compiler?</p>
  
  <pre><code>auto pLoc = someMap.lower_bound(someKey);
  if(pLoc != someMap.end() &amp;&amp; !(someMap.key_comp()(someKey, pLoc-&gt;first)))
      return pLoc-&gt;second;
  else
      auto newValue = expensiveCalculation();
      someMap.insert(pLoc, make_pair(someKey, newValue));  // using the lower bound as hint
      return newValue;
  </code></pre>
  
  <p>What would be the best way to improve this pattern for use with C++11?</p>