title: C++: STL multimap.equal_range()
body: <p>I've got this code and I cannot understand part where <strong>equal_range</strong> method returns iterators.
  I know range is <strong><em>pair</em></strong> object with two multimap objects inside, but what I don't get, is why there is  <code>'for (it = range.first; it != range.second; ++it)'</code> - What does this mean exactly ? </p>
  
  <pre><code>// multmap.cpp -- use a multimap
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;map&gt;
  #include &lt;algorithm&gt;
  
  typedef int KeyType;
  typedef std::pair&lt;const KeyType, std::string&gt; Pair;
  typedef std::multimap&lt;KeyType, std::string&gt; MapCode;
  
  int main()
  {
  using namespace std;
  MapCode codes;
  codes.insert(Pair(415, "San Francisco"));
  codes.insert(Pair(510, "Oakland"));
  codes.insert(Pair(718, "Brooklyn"));
   codes.insert(Pair(718, "Staten Island"));
    codes.insert(Pair(415, "San Rafael"));
    codes.insert(Pair(510, "Berkeley"));
  
    cout &lt;&lt; "Number of cities with area code 415: "
      &lt;&lt; codes.count(415) &lt;&lt; endl;
    cout &lt;&lt; "Number of cities with area code 718: "
      &lt;&lt; codes.count(718) &lt;&lt; endl;
    cout &lt;&lt; "Number of cities with area code 510: "
      &lt;&lt; codes.count(510) &lt;&lt; endl;
    cout &lt;&lt; "Area Code City\n";
  
    MapCode::iterator it;
    for (it = codes.begin(); it != codes.end(); ++it)
    cout &lt;&lt; " " &lt;&lt; (*it).first &lt;&lt; " "
    &lt;&lt; (*it).second &lt;&lt; endl;
  
    pair&lt;MapCode::iterator, MapCode::iterator&gt; range
          = codes.equal_range(718);
  
    cout &lt;&lt; "Cities with area code 718:\n";
    for (it = range.first; it != range.second; ++it) //&lt;------------------ here
    cout &lt;&lt; (*it).second &lt;&lt; endl;
      return 0;
  }
  </code></pre>