title: Does hash_map automatically sort [C++]?
body: <p>In the below code, hash_map is automatically sorting or maybe inserting elements in a sorted order. Any ideas why it does this?? Suggestions Please??
  This is NOT a homework problem, trying to solve an interview question posted on glassdoor dot com.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;ext/hash_map&gt;
  #include &lt;map&gt;
  #include &lt;string.h&gt;
  #include &lt;sstream&gt;
  
  using namespace __gnu_cxx;
  using namespace std;
  
  struct eqstr
  {
    bool operator()(int i, int j) const
    {
      return i==j;
    }
  };
  typedef hash_map&lt;int, int, hash&lt;int&gt;, eqstr&gt; myHash;
  int main()
  {
      myHash array;
      int inputArr[20] = {1,43,4,5,6,17,12,163,15,16,7,18,19,20,122,124,125,126,128,100};
  
      for(int i=0;i&lt;20;i++){
          array[inputArr[i]] = inputArr[i]; //save value
      }
      myHash::iterator it = array.begin();
      int data;
      for (; it != array.end(); ++it) {
          data =  it-&gt;first;
          cout &lt;&lt; ":: " &lt;&lt; data;
      }
  }
  
  //!Output ::: 1:: 4:: 5:: 6:: 7:: 12:: 15:: 16:: 17:: 18:: 19:: 20:: 43:: 100:: 122:: 124:: 125:: 126:: 128:: 163
  </code></pre>