title: Efficiency of map::count followed by map::operator[]
body: <p>There's a kind-of known problem that when a map contains some elements and the access to that element is needed, while the "element not found" situation is preferred to be handled by just if-check, there's still lacking a standard method to easily "please give me access to the element mapped at given key, tell me by some meaningful value that it doesn't exist, and let me access it otherwise".</p>
  
  <p>My goal is: I need a clean, easy method, looking good an readably in the code, and, of course, efficient. This is the "official" way to do it:</p>
  
  <pre><code>map&lt;int, vector&lt;Command&gt; &gt; m;
  map&lt;int, vector&lt;Command&gt; &gt;::iterator i = m.find(required_key);
  if ( i == m.end() )
       error_not_found();
  i-&gt;second.SetCode(x);
  </code></pre>
  
  <p>This is what I use, and prefer due to readability - my question is: <strong>how less efficient is this method towards the official one above</strong>:</p>
  
  <pre><code>map&lt;int, vector&lt;Command&gt; &gt; m;
  if ( !m.count(required_key) )
     error_not_found();
  m[required_key].SetCode(x);
  </code></pre>