title: Foreach through a vector containing pointers in c++
body: <p>I made a map filled with vectors which looks like this:</p>
  
  <pre><code>std::map&lt;int, std::vector&lt;CClass*&gt;&gt; pointers = getMap();
  </code></pre>
  
  <p>And now I want to go through every slot of the map and also through every slot of the vector stored in the map.</p>
  
  <p>This is how it goes through the map:</p>
  
  <pre><code>for (std::map&lt;int, std::vector&lt;CClass*&gt;&gt;::iterator it = pointers.begin(); it != pointers.end(); it++) 
  </code></pre>
  
  <p>This works fine and it goes through every object just like I want it to.</p>
  
  <p>But now I want to go through every slot in the vector and I tried it like this:</p>
  
  <pre><code>for (std::vector&lt;CClass*&gt;::iterator playerIt = it-&gt;second.begin(); playerIt != it-&gt;second.end(); playerIt++) 
  </code></pre>
  
  <p>If I want to access the value stored in it the compiler gives me this error:</p>
  
  <pre><code>file.cpp(552) : error C2839: Ungültiger Rückgabetyp 'CClass **' für überladenen Operator '-&gt;'
  </code></pre>
  
  <p>Which means "invalid return-type 'CClass **' for overweight operator '->'</p>
  
  <p>regards</p>