Why can I allocate an array of objects but not put them in a vector?
<p>I have a class that I want to contain multiple objects of something I created. Right now the code that works is:</p>

<p><strong>process.h:</strong></p>

<pre><code>private:
  myObj *data;
</code></pre>

<p><strong>process.cc:</strong></p>

<pre><code>data = new myObj[10];
</code></pre>

<p>I would like to pass a value to the constructor however, so I tried to convert it to a std::vector (after modifying constructor to take a value).</p>

<p><strong>process.h:</strong></p>

<pre><code>private:
  std::vector&lt;myObj&gt; data;
</code></pre>

<p><strong>process.cc:</strong></p>

<pre><code>for (int m=0; m&lt;10; m++) data.push_back( myObj(1.2) );
</code></pre>

<p>When I try that it crashes upon execution with</p>

<pre><code>*** glibc detected *** ... corrupted double-linked list: ... ***
</code></pre>

<p>And the backtrace in gdb shows an error in the destructor when I tried to free some memory for other arrays I allocated. A search didn't show up anything that was obvious. I am using a few static member variables in <code>myObj</code>, could that be an issue?</p>
