title: How to iterate through a map in a vector of maps?
body: <p>Code written in C++</p>
  
  <p>Environment: Microsoft Visual Studio</p>
  
  <p>I have a vector of maps.
  First I want to iterate through the first map, get its 'first' and 'second' and save them in some other structure I built (a map of vectors).
  And then I'll iterate through the left maps in my "vector of maps" and do the same...</p>
  
  <p>Here's my vector of maps:</p>
  
  <pre><code>typedef vector&lt;map&lt;string,unsigned int&gt;&gt; myvec;
  </code></pre>
  
  <p>And here's the function that should do the work:</p>
  
  <pre><code>void Coogle::make_index(const myvec&amp; the_vec)
  {
      //SCAN THE FIRST MAP
      map&lt;string,unsigned int&gt;::iterator map_iter;
      index::iterator idx_iter = the_index.begin();
      for(map_iter=the_vec[0].begin(); map_iter!=the_vec[0].end(); ++map_iter)
      {
  
      }
  }
  </code></pre>
  
  <p>The 'for' loop should iterate through the first map in the vector.
  I declared a map iterator because I need it to iterate though the map! Right?
  Why isn't it working?</p>
  
  <p>the error:</p>
  
  <blockquote>
    <p>IntelliSense: no operator "=" matches these operands</p>
  </blockquote>
  
  <p>Thanks a lot !!!</p>
  
  <hr>
  
  <p>OK now I identified this iterator:</p>
  
  <pre><code>index::iterator idx_iter = the_index.begin();
  </code></pre>
  
  <p>And here's my 'index':</p>
  
  <pre><code>typedef map&lt;string,vector&lt;unsigned int&gt;&gt; index;
  </code></pre>
  
  <p>And inside the mentioned 'for' loop I did the following:</p>
  
  <pre><code>    for(map_iter=the_vec[0].begin(); map_iter!=the_vec[0].end(); ++map_iter)
      {
          /*#1*/ idx_iter-&gt;first = map_iter-&gt;first;
          /*#2*/ idx_iter-&gt;second[0] = map_iter-&gt;second;
          /*#3*/ idx_iter++;
      }
  </code></pre>
  
  <p>#2 seems to be ok. But #1 generates an error:</p>
  
  <blockquote>
    <p>IntelliSense: no operator "=" matches these operands</p>
  </blockquote>
  
  <p>It's the same error like the one before so I'm guessing it's a similar problem.
  Is it?</p>
  
  <p><strong>edit:</strong> To be more clear, what I wanna do is add from <strong>const myvec&amp; the_vec</strong> to the 'i' location (in this case '0') to my index.</p>
  
  <p>Again :</p>
  
  <pre><code>typedef vector&lt;map&lt;string,unsigned int&gt;&gt; myvec;
  typedef map&lt;string,vector&lt;unsigned int&gt;&gt; index;
  </code></pre>
  
  <p>Thank you!</p>