title: map iterator: invalid type argument of unary '*' (have 'int')
body: <p>I get this compilation error:</p>
  
  <blockquote>
    <p>error: invalid type argument of unary '<code>*</code>' (have '<code>int</code>')<br>
        <code>_M_insert_unique_(end(), *__first);</code></p>
  </blockquote>
  
  <p>I've tried using <code>(*cols_it).first</code> and <code>(*cols_it).second</code> and every other permutation I can think of, but I can't make it compile.  What should I be writing?</p>
  
  <p>Here's some of the code:</p>
  
  <pre><code>#include &lt;map&gt;
  #include &lt;vector&gt;
  
  using std::map;
  using std::vector;    
  
  void setZeroes(vector&lt;vector&lt;int&gt; &gt; &amp;A) {
      map&lt;int,int&gt; rows;
      map&lt;int,int&gt; cols;
      for (unsigned int x = 0; x &lt; A[0].size(); x++) {
          for (unsigned int y = 0; y &lt; A.size(); y++) {
              if (A[x][y] == 0) {
                  rows.insert(y,y); // error reported here
                  cols.insert(x,x);
              }
          }
      }
      map&lt;int,int&gt;::iterator rows_it = rows.begin();
      map&lt;int,int&gt;::iterator cols_it = cols.begin();
      while (rows_it != rows.end()) {
          for (unsigned int i = 0; i &lt; A[0].size(); i++) {
              int val = rows_it-&gt;second;
              A[val][i] = 0;
          }
          rows_it++;
      }
      while (cols_it != cols.end()) {
          for (unsigned int i = 0; i &lt; A.size(); i++) {
              int val = cols_it-&gt;second;
              A[i][val] = 0;
          }
          cols_it++;
      }
  }
  </code></pre>