title: C++ iterate over iterator
body: <p>I am currently "modernizing" my toy-compiler code to use as many C++11 features as possible to learn how to write modern C++. While looking at my code, searching for things to modernise I found this construct:</p>
  
  <pre><code>for (size_t i = 0; i &lt; _vector.size(); i++) {
     for (size_t j = 0; j &lt; _vector[i].length(); j++) {
  </code></pre>
  
  <p>_vector is a <code>std::vector&lt;std::string&gt;</code> containing the source code of the file which needs to be compiled. Each <code>std::string</code> in the vector is a line of code which needs to be compiled. Before compilation takes place the compiler checks whether the code to be compiled has any syntax errors, and the first step of this check is to look out for missing semicolons. I do this by looking at each character one by one and checking if said character is a semicolon. If it is, I perform a check whether the semicolon is needed by building a kind of mini-syntax-tree and thereby determining if it is necessary. I currently access each character with <code>_vector[i][j]</code> which is very reminiscent of ANSI-C (this is how you access each character in an array of char*) and I want to replace this with iterators. As far as I know, an Iterator is a pointer-like construct which points to an element in a container/sequence/whatever. Applying the pointer analogy I deduced that an <code>std::vector&lt;std::string&gt;::iterator</code> points to a string in a vector, therefore a theoretical <code>std::vector&lt;std::string&gt;::iterator::iterator</code> would point to a single character in a string object. But because there isn't such thing in the STL the pointer analogy isn't of much use here. So my question is: How do I access each Character within a <code>std::vector&lt;std::string&gt;::iterator</code>?  </p>