iterator vs. subscript
<p>I have a question about the preference between iterator and subscripting. For example, if I am doing something like:</p>

<pre><code>for (vector&lt;int&gt;::size_type i = 0; i != ivec.size(); ++i) {
  ivec[i] related operation
}

for (vector&lt;int&gt;::iterator it = ivec.begin(); it != ivec.end(); ++it) {
  *it related operation
}
</code></pre>

<p>Which one is preferred? In the perspective of:
1. Performance
2. Clarity
3. Other concerns?</p>

<p>I am aware this question have been previously discussed <a href="http://stackoverflow.com/questions/131241/why-use-iterators-instead-of-array-indices">link</a>. But in the other post it only talked about the performance cost of size(); </p>

<p>Suppose this is about vector, and the cost of size() is negligible.</p>

<p>what about cost of using subscript vs. iterator?</p>

<p>Thanks.</p>
