title: Iterating over const_iterator
body: <p>ALL,</p>
  
  <p>I have a function with the following signature:</p>
  
  <pre><code>void foo(const std::vector&lt;Bar *&gt; &amp;myvec);
  </code></pre>
  
  <p>Inside this function I need to loop thru the members of the vector and perform some operations.</p>
  
  <p>So, I tried this:</p>
  
  <pre><code>for( std::vector&lt;Bar *&gt;::const_iterator it = myvec.begin(); it &lt; myvec.end(); ++it )
  {
      // modify properties of Bar * pointer
      (*it)-&gt;SetSomeValue( baz );
  }
  </code></pre>
  
  <p>however this code asserts since the iterator is constant.</p>
  
  <p>Now obviously the vector is constant, which means that the function shouldn't be modifying myvec.</p>
  
  <p>What's the best solution here?</p>
  
  <p>Can I use const_cast here to remove constness? It would be kind of hack-ish, but if it works.</p>
  
  <p>But I feel there must be a better solution.</p>
  
  <p>TIA!!</p>