title: How to iterate a map of type <string,long>?
body: <pre><code>map&lt;string,long&gt;::iterator iter; iter=phonebook.begin();
      while (iter != phonebook.end()){
          if(name==(*itr).first){
              cout&lt;&lt;(*itr).first&lt;&lt;&quot;=&quot;&lt;&lt;(*itr).second&lt;&lt;endl;
              c=1;
              break;
          }
  </code></pre>
  <p>This code throws this error:</p>
  <pre class="lang-sh prettyprint-override"><code>[Error] no match for 'operator=' (operand types are 'std::map&lt;std::basic_string&lt;char&gt;, long int&gt;::iterator {aka std::_Rb_tree_iterator&lt;std::pair&lt;const std::basic_string&lt;char&gt;, long int&gt; &gt;}'
                                                  and 'std::map&lt;std::basic_string&lt;char&gt;, int&gt;::iterator      {aka std::_Rb_tree_iterator&lt;std::pair&lt;const std::basic_string&lt;char&gt;, int&gt; &gt;}')
  </code></pre>