std::map key value pairs not iterating in sequence : <p>I am inserting key value pairs in a <code>std::map</code> as</p>

<pre><code>key = //something;
value = //something;
demoMap[key] = value;
</code></pre>

<p>Printing the key and value here gives me correct results. However, when I iterate this map as:</p>

<pre><code>for( std::map&lt;std::string, std::string&gt;::iterator it = demoMap.begin();
     it != demoMap.end(); it++ ) {
    std::cout &lt;&lt; it-&gt;first + "," &lt;&lt; it-&gt;second;
}
</code></pre>

<p>Using above iteration, I get the second key value pair printed before the first one. Why is it so? The first key value pair should be printed first since the iterator of the map is set to <code>begin()</code> for the map.</p>
