how much work is done by calling vector.size()?
<p>Is it a simple getter? or is it calculating every time?</p>

<p>If I have a for loop like this:</p>

<pre><code>for (int i = 0; i &lt; myVector.size(); i++) { }
</code></pre>

<p>where I only need to use the size once, would it be better to calculate this once before the loop and store it in a variable? Or is size() just a simple getter and it would make little difference?</p>
