title: Dereferencing char iterator
body: <p>I am new in c++ and just learned about iterators. I have this code:</p>
  <pre><code>//lines is a vector&lt;string&gt;
  for (auto it = lines.begin(); it != lines.end(); ++it) {
      //I want to access each characters in each element (string) of the vector
      for (auto it2 = *it-&gt;begin(); it2 != *it-&gt;end(); ++it2) {
          cout &lt;&lt; *it2 &lt;&lt; endl; //error: invalid type argument of unary '*' (have 'char')
      }
      cout &lt;&lt; *it &lt;&lt; endl; //ok
  }
  </code></pre>
  <p>I tested asigning the string to a variable:</p>
  <pre><code>string word = *it;
  for (auto it2 = word.begin(); it2 != word.end(); ++it2) {
      cout &lt;&lt; *it2 &lt;&lt; endl; //ok
  }
  </code></pre>
  <p>My question is why the second code works while the first doesn't? It seems to me that *it2 is a string and I can access the chars inside it using an iterator but it turns out I have to assign it to a variable for it to work. I don't understand the compiler error. What's the difference?</p>