title: Can any C++ 98 standard container operations throw std::bad_alloc?
body: <p>I was trying to work out if the try catch is needed in the following code:</p>
  
  <pre><code>std::vector&lt;int&gt; values;
  // ignore that this can throw std::bad_alloc
  values.push_back(1);
  try {
      for (std::vector&lt;int&gt;::iterator iter = values.begin();
           iter != values.end(); ++iter) {
           ++(*iter);
      }
  } catch (const std::bad_alloc&amp;) { 
      // Is this needed?
  }
  </code></pre>
  
  <p>Looking through the C++ 1998 standard the only thing I can find which hints at this is section 23.1 "Container requirements" bullet point 8 which contains the sentence:</p>
  
  <blockquote>
    <p>A copy of this argument is used for any memory allocation performed, by these constructors and by all member functions, during the lifetime of each container object. </p>
  </blockquote>
  
  <p>My interpretation of this is that any member function in a container can call the allocator so any member function can throw std::bad_alloc. Am I being overly paranoid or is this really the case?</p>