title: std::vector and Constructors
body: <p>Which constructor does std::vector call when it is making a new instance of the object it's containing? I am under the impression it calls a default constructor but what if one is not defined or is the compiler doing that for me?</p>
  
  <p>Particularly in a case as such:</p>
  
  <pre><code>class Foo
  {
      public:
          Foo(int size)
          {
              data = new double[size];
          }
  
  
          ~Foo()
          {
              delete[] data;
          }
  
      private:
          double* data;
  };
  
  std::vector&lt;Foo&gt; myVector;
  Foo bar(5);
  myVector.push_back(bar);
  //stuff
  </code></pre>
  
  <p>How does it know how much memory to allocate when the object has an unknown size until after construction?</p>