title: Is the order of iterating through std::map known (and guaranteed by the standard)?
body: <p>What I mean is - we know that the <code>std::map</code>'s elements are sorted according to the keys. So, let's say the keys are integers. If I iterate from <code>std::map::begin()</code> to <code>std::map::end()</code> using a <code>for</code>, does the standard guarantee that I'll iterate consequently through the elements with keys, sorted in ascending order?</p>
  
  <hr>
  
  <p>Example:</p>
  
  <pre><code>std::map&lt;int, int&gt; map_;
  map_[1] = 2;
  map_[2] = 3;
  map_[3] = 4;
  for( std::map&lt;int, int&gt;::iterator iter = map_.begin();
       iter != map_.end();
       ++iter )
  {
      std::cout &lt;&lt; iter-&gt;second;
  }
  </code></pre>
  
  <p>Is this guaranteed to print <code>234</code> or is it implementation defined?</p>
  
  <hr>
  
  <p>Real life reason: I have a <code>std::map</code> with <code>int</code> keys. In very rare situations, I'd like to iterate through all elements, with key, greater than a concrete <code>int</code> value. Yep, it sounds like <code>std::vector</code> would be the better choice, but notice my "very rare situations".</p>
  
  <hr>
  
  <p><strong>EDIT</strong>: I know, that the elements of <code>std::map</code> are sorted.. no need to point it out (for most of the answers here). I even wrote it in my question.<br>
  I was asking about the iterators and the order when I'm iterating through a container. Thanks @Kerrek SB for the answer.</p>