title: STL <map> allows duplicate pairs?
body: <p>I have written the following code and was surprised at the output. I heard that <code>&lt;map&gt;</code> avoids collision of keys, but here it appears to allow insertion of duplicate pairs.</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;map&gt;
  
  using namespace std;
  
  int main()
  {
      map&lt;string,char&gt; namemap;
      namemap["yogi"]='c';
  
      namemap.insert(pair&lt;string,char&gt;("yogendra",'a'));
      namemap.insert(pair&lt;string,char&gt;("yogendra",'b'));
  
      cout&lt;&lt;namemap["yogendra"]&lt;&lt;endl;
  
      return 0;
  }
  </code></pre>
  
  <p>This code outputs <code>a</code>.  You can run it on <a href="http://cpp.sh/5u5k" rel="noreferrer">C++ Shell</a>.</p>
  
  <p>Does avoiding collision means that we cannot enter multiple pairs with same key?</p>