title: map/set iterators incompatible [c++]
body: <p>I'm trying to iterate through a map, as shown below:</p>
  
  <pre><code>data = &amp;server-&gt;update();
  
      for (auto const iter : *data)
      {
          do things
      }
  </code></pre>
  
  <p>but as soon as the for line runs, I get an error stating "map/set iterators incompatible".</p>
  
  <p>The data variable is a </p>
  
  <pre><code>std::map&lt;unsigned int, Packet&gt; *data;
  </code></pre>
  
  <p>It is a pointer because it is located in:</p>
  
  <pre><code>public ref class ServerForm : public System::Windows::Forms::Form
  </code></pre>
  
  <p>and that seems to not like anything that isn't a pointer.</p>
  
  <p>I've tried multiple ways of iterating through this map and every attempt fails completely. I would really appreciate some insight into why this happens and how to solve it, thanks.</p>