title: How does std::vector allocate objects?
body: <p>How does <code>std::vector</code> allocate objects? It would seem as if it just uses <code>std::allocator::allocate</code> to create a block of memory, but then never calls <code>std::allocate::construct</code>. Is this true? Does <code>std::vector</code> only allocate memory and never construct the objects as memory allocation?</p>
  
  <p>What if there is no default constructor? How is the constructor called when there is no default constructor on the object? What if there is more than one parameter?</p>
  
  <p>For example, with this code there is no default constructor and std::allocator allows it.</p>
  
  <pre><code>#include &lt;vector&gt;
  using namespace std;
  
  class A{
  protected:
      int m;
  public:
      explicit A(int a) : m(a) { }
  };
  
  int main(){
      vector&lt;A&gt; test;
      return 0;
  }
  </code></pre>