title: C++ How to loop through a list of structs and access their properties
body: <p>I know I can loop through a list of strings like this:</p>
  
  <pre><code>list&lt;string&gt;::iterator Iterator;
   for(Iterator = AllData.begin(); 
     Iterator != AllData.end();
     Iterator++)
   {
    cout &lt;&lt; "\t" + *Iterator + "\n";
   }
  </code></pre>
  
  <p>but how can I do something like this?</p>
  
  <pre><code>list&lt;CollectedData&gt;::iterator Iterator;
   for(Iterator = AllData.begin(); 
     Iterator != AllData.end();
     Iterator++)
   {
    cout &lt;&lt; "\t" + *Iterator.property1 + "\n";
    cout &lt;&lt; "\t" + *Iterator.property2 + "\n";
   }
  </code></pre>
  
  <p>or if someone can explain how to do this with a <code>for_each</code> loop, that would be very helpful as well, but it seemed more complicated from what I've read.</p>
  
  <p>thank you so much</p>