title: C++ vector size types
body: <p>I just started learning C++ and have a question about vectors.
  The book I'm reading states that if I want to extract the size of a vector of type double (for example), I should do something like:</p>
  
  <pre><code>vector&lt;double&gt;::size_type vector_size;
  vector_size = myVector.size();
  </code></pre>
  
  <p>Whereas in Java I might do</p>
  
  <pre><code>int vector_size;
  vector_size = myVector.size();
  </code></pre>
  
  <p>My question is, why is there a type named vector::size_type? Why doesn't C++ just use int? </p>