title: How do I iterate through a vector that has struct pointers?
body: <pre><code>struct some_struct{
       some_struct *pointer_to_another_struct;
       int a;
  some_struct(int value ) :a (value), pointer_to_another(NULL)()
  };
  
  ...
  
  vector&lt;some_struct *&gt; tree;
  ...
  
  for ( auto it = tree.begin(); it != tree.end();  ++it) {
       it-&gt;a=10;
  }
  </code></pre>
  
  <p>This apparently is not the correct way to iterate through a vector of struct pointers because my compiler is giving me errors. How can I fix it? Also, is there anything I should worry about when I store pointers in a vector?</p>