What is C++ string's default capacity? : <p>Consider the following snippet:</p>

<pre><code>string line; 
line = "";
cout &lt;&lt; line[400] &lt;&lt; endl; //Works, random character 
cout &lt;&lt; line[20000] &lt;&lt; endl; //Segmentation Fault
</code></pre>

<p>Looks like c++ string has a default capacity to prevent bad things happen when reaching beyond the boundary. But I can't find any more resources on this topic.</p>

<p>I compiled the snippet with clang under mac environment. </p>
