title: How does vector's growth function work?
body: <pre><code>int main () {
      std::vector &lt;int&gt; elements;
      elements.push_back (1);
      elements [10000] = 102;
      std:: cout &lt;&lt; elements [10000];
      return 0;
  }
  </code></pre>
  
  <p>How does the above code work? As far as I have read, vector's growth will be 1.5 - 2x. So how is the 10000th element stored here? Isn't the expected behavior here a "Segmentation fault"? But the above runs successfully.</p>