title: allocation error on C++ vector
body: <p>I'm trying to allocate a <code>vector&lt;vector&lt;Class&gt;&gt;</code> which contain itself a <code>vector&lt;AnotherClass&gt;</code>, but I obtain an allocation error, so my question is: the <code>max_size()</code> given on a variable apply for all the vector of my program ?</p>
  
  <p>Can I change this limit by changing my compiler ?</p>
  
  <p>Here the code I used to check that :</p>
  
  <pre><code>class Couches
  {
  public:
      Couches() : m_value(-1) {}
      ~Couches() {}
  
      void initialize(const int&amp; value) {
          m_value = value;
      }
  private :
      int m_value;
  };
  
  class Case
  {
  public :
      Case() {}
      ~Case() {}
  
      void initialize(const int&amp; hauteur) {
          m_couches.resize(hauteur);
          for (int i(0); i&lt;hauteur;i++)
              m_couches[i].initialize(i);
      }
  private :
      vector&lt;Couches&gt; m_couches;
  };
  
  
  void bug1()
  {
      vector&lt;vector&lt;Case&gt;&gt; m_cases;
      m_cases.resize(5000, vector&lt;Case&gt;(5000));
  
      cout&lt;&lt; m_cases.max_size()&lt;&lt;" " &lt;&lt;5000*5000*20&lt;&lt;endl;
  
      for (int i(0); i&lt;m_cases.size(); i++)
      {
          for (int j(0); j&lt;m_cases[i].size(); j++)
          {
              m_cases[i][j].initialize(20);
          }
      }
  }
  </code></pre>
  
  <p>I have a max_size of 357M &lt; 500M I was expected to create.</p>
  
  <p>EDIT : Sorry guys I said error but it's an error given by the debugger : </p>
  
  <pre><code>#1 0x405b36 operator new(unsigned int) () (??:??)
  
  #2 0x490f58 typeinfo for std::time_put&lt;wchar_t, std::ostreambuf_iterator&lt;wchar_t, std::char_traits&lt;wchar_t&gt; &gt; &gt; () (??:??)
  
  #3 0x4761ac std::allocator_traits&lt;std::allocator&lt;Couches&gt; &gt;::allocate(__a=..., __n=0) (D:/CodeBlocks/MinGW/lib/gcc/mingw32/4.9.2/include/c++/bits/alloc_traits.h:357)
  
  terminate called after throwing an instance of 'std::bad_alloc'
    what():  std::bad_alloc
  </code></pre>
  
  <p>I use an initialize function because it is a mcve and in my original code I need this function.</p>