title: Is vector.size() function computational heavy?
body: <p>Just want to know is the size function computational costly or not?</p>
  
  <pre><code>vector&lt;someBigType&gt; vec;
  vec.push_back(something0);
  for(unsigned i = 0; i &lt; a bigNumber; ++i)
  {
  
      // do something ...
  
      // measure the size
      int size1 = vec.size();
  
      // A lot of push_backs (vec may grow very large)
      vec.push_back(something);
  
      // Or shall I just use counter++, whenever a push_back is called?
  
      // measure the size again
      int size2 = vec.size();
  
      int delta = size2-size1;
  
      // Use delta to do something
  }
  </code></pre>