title: How could map::erase know if the interval is valid?
body: <p>I'm writing a simple program which makes use of <code>std::map::erase</code>.
  The program is fine, but there is something I do not understand.</p>
  <p>If I pass to the <code>erase</code> function an interval in which the first iterator is beyond the second one, the function does not erase anything. And it is good.</p>
  <p>On the other side, if I use <code>std::distance</code> with the first iterator beyond the second one this function &quot;fails&quot;. I know that this is due to the nature of the map's iterator, and for example with <code>std::vector</code> there is not this problem.</p>
  <p>But I do not understand how <code>map::erase</code> could know whether the interval is valid or not.</p>