title: How big can the string class in C++ get?
body: <p>I think the error has to do with my string being too large.  If the function worked correctly, I doubt that I would be anywhere near the max string size (unless that really is the problem?  I doubt it because this is for a HW assignment and we need to return <code>output</code> with the song lyrics).  What is throwing this error?  How big can the string get?</p>
  
  <p>Error:</p>
  
  <pre><code>terminate called after throwing an instance of 'std::length_error'  
  what():  basic_string::_S_create 
  Aborted (core dumped)
  </code></pre>
  
  <p>Function:</p>
  
  <pre><code>string generateSong(string list[], int num)
  {
     string output;
  
     for(int count = 0; count &lt;= num; count++)
        output += list[count] + " bone connected to the "
        + list[count + 1] + " bone\n";
  
     return output;
  }
  </code></pre>
  
  <p>Contents of <code>list[]</code>:</p>
  
  <pre><code>string list[9] =
     {
        "toe",
        "foot",
        "leg",
        "knee",
        "hip",
        "back",
        "neck",
        "jaw",
        "head"
     };
  </code></pre>
  
  <p><code>num</code> is 9.  Is <code>output</code> really becoming too big?  Everything compiles fine (using g++).</p>