title: How to iterate through a list of objects in C++?
body: <p>I'm very new to C++ and struggling to figure out how I should iterate through a list of objects and access their members.</p>
  <p>I've been trying this where <code>data</code> is a <code>std::list</code> and <code>Student</code> a class.</p>
  <pre><code>std::list&lt;Student&gt;::iterator&lt;Student&gt; it;
  for (it = data.begin(); it != data.end(); ++it) {
      std::cout&lt;&lt;(*it)-&gt;name;
  }
  </code></pre>
  <p>and getting the following error:</p>
  <pre><code>error: base operand of ‘-&gt;’ has non-pointer type ‘Student’
  </code></pre>