title: stl map operator[] bad?
body: <p>My code reviewers has pointed it out that the use of operator[] of the map is very bad and lead to errors:</p>
  
  <pre><code>map[i] = new someClass;    // potential dangling pointer when executed twice
  </code></pre>
  
  <p>Or</p>
  
  <pre><code>if (map[i]==NULL) ...      // implicitly create the entry i in the map 
  </code></pre>
  
  <p>Although I understand the risk after reading the API that the <code>insert()</code> is better of since it checks for duplicate, thus can avoid the dangling pointer from happening, I don't understand that if handled properly, why <code>[]</code> can not be used at all?</p>
  
  <p>I pick map as my internal container exactly because I want to use its quick and self-explaining indexing capability.</p>
  
  <p>I hope someone can either argue more with me or stand on my side:)</p>