title: Error: a class qualified name is not allowed
body: <p>In line using std::list::iterator the compiler gives an message "Error: a class-qualified name is not allowed. I am unsure what is the problem? Can someone expand on the compilers problem with my code.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;list&gt;
  
  using std::cout;
  using std::endl;
  using std::list;
  using std::list&lt;int&gt;::iterator;
  int main( )
  {
  list&lt;int&gt; listObject;
  for (int i = 1; i &lt;= 3; i++)
      listObject.push_back(i);
  cout &lt;&lt; "List contains:\n";
  iterator iter;
  for (iter = listObject.begin( ); iter != listObject.end( ); iter++)
      cout &lt;&lt; *iter &lt;&lt; " ";
  cout &lt;&lt; endl;
  cout &lt;&lt; "Setting all entries to 0:\n";
  for (iter = listObject.begin( ); iter != listObject.end( ); iter++)
      *iter = 0;
  cout &lt;&lt; "List now contains:\n";
  for (iter = listObject.begin( ); iter != listObject.end( ); iter++)
      cout &lt;&lt; *iter &lt;&lt; " ";
  cout &lt;&lt; endl;
  return 0;
   }
  </code></pre>