title: C++ vector class throwing exceptions
body: <p>I have created a vector that contains 4 strings, now I want to read each one from the first to the last and store the string in exr. I am using this code, but once j becomes 3 it throws the exception thus not extracting the last value and also the exception is not caught. cc is a string vector. I used the debugger and the strings are inside the vector. With this code I just need to process each string until there are no more that is why when I catch the exception I used break to jump out of the for cycle, index is bigger than the actual elements in the vector.</p>
  
  <pre><code>   std::vector&lt;string&gt; cc;
     std::vector&lt;string&gt;::iterator it;
     it = cc.end();
     // code that stores 4 strings in cc....
     ....
     string exr;
     for (int j = 0; j &lt; index; j++)
     {
         try
         {
             exr = cc.at(j);
         }
         catch (out_of_range d)
         {
             break;
         }
         //other code that use exr...
     }
  </code></pre>