title: What is the use of emplace_hint in map?
body: <p>I understand that map::emplace_hint is used to place a key,value pair at a specified place in the map but in the end the map gets sorted so what is the point of placing it in a certain place?
  for example, when i ran this code : </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;map&gt;
  #include &lt;unordered_map&gt;
  
  int main()
  {
      std::map&lt;char, int&gt; mymap;
      auto it = mymap.end();
      std::unordered_map&lt;char, int&gt; mymap2;
  
  
      it = mymap.emplace_hint(it, 'b', 10);
      mymap.emplace_hint(it, 'z', 12);
      mymap.emplace_hint(mymap.end(), 'a', 14);
      mymap.emplace_hint(mymap.end(), 'c', 10);
  
      auto it2 = mymap2.end();
      it2 = mymap2.emplace_hint(it2, 'b', 10);
      mymap2.emplace_hint(it2, 'z', 12);
      mymap2.emplace_hint(mymap2.end(), 'a', 14);
      mymap2.emplace_hint(mymap2.end(), 'c', 10);
  
  
      std::cout &lt;&lt; "mymap contains:";
      for (auto&amp; x : mymap)
          std::cout &lt;&lt; " [" &lt;&lt; x.first &lt;&lt; ':' &lt;&lt; x.second &lt;&lt; ']';
      std::cout &lt;&lt; '\n';
  
      for(auto&amp; y :mymap2)
          std::cout &lt;&lt; " [" &lt;&lt; y.first &lt;&lt; ':' &lt;&lt; y.second &lt;&lt; ']';
      char c;
      std::cin &gt;&gt; c;
      return 0;
  }
  </code></pre>
  
  <p>it gave me this o/p :</p>
  
  <pre><code>mymap contains: [a:14] [b:10] [c:10] [z:12]
   [z:12] [b:10] [a:14] [c:10]
  </code></pre>