title: Iterate through a C++ Vector using a 'for' loop
body: <p>I am new to the C++ language. I have been starting to use vectors, and have noticed that in all of the code I see to iterate though a vector via indices, the first parameter of the <code>for</code> loop is always something based on the vector. In Java I might do something like this with an ArrayList:</p>
  
  <pre><code>for(int i=0; i &lt; vector.size(); i++){
     vector[i].doSomething();
  }
  </code></pre>
  
  <p>Is there a reason I don't see this in C++? Is it bad practice?</p>