title: Struggling with const behaviour when using vectors and iterators
body: <p>I'm having trouble with using vectors, iterators and then using <code>const</code>.</p>
  
  <p>For a bit of context I'm trying to create a write method for a <code>vector&lt;string&gt;</code> so I can easily print out all the strings within the vector.</p>
  
  <p>Here's the bit of code: </p>
  
  <pre><code>void ArrayStorage::write(ostream &amp;sout) const{
      for (vector&lt;string&gt;::iterator stringIt = _dataVector.begin();
                      stringIt &lt; _dataVector.end();
                      stringIt++){
          sout &lt;&lt; *stringIt;
      }
  }
  
  ostream&amp; operator&lt;&lt;(ostream &amp;sout, const ArrayStorage &amp;rhs){
      rhs.write(sout);
      return sout;
  }
  </code></pre>
  
  <p>When I try this I end up getting an error on line 2:</p>
  
  <blockquote>
    <p>cannot convert from '<code>std::_Vector_const_iterator&lt;_Myvec&gt;</code>' to '<code>std::_Vector_iterator&lt;_Myvec&gt;</code>'.</p>
  </blockquote>
  
  <p>So I have to remove the <code>const</code> from the end of the write method, and then for the <code>operator&lt;&lt;</code> to work I have to remove the <code>const</code> from the rhs parameter.</p>
  
  <p>Why is this? I am not trying to change any class members, so I don't understand what's going on... What is it I am missing?</p>