title: Controlling memory with std::vector<T*>
body: <p>Suppose that <code>T</code> contains an array whose size may vary depending on initialization. I'm passing a pointer to the vector to avoid copying all the data, and initialize as follows:</p>
  
  <pre><code>for(int i=10; i &lt; 100; i++)
      std::vector.push_back(new T(i));
  </code></pre>
  
  <p>On exiting, one <code>delete</code>s the element's of the vector. Is there a risk of memory loss if the data contained in <code>T</code> is also a pointer, even if there are good destructors? Eg</p>
  
  <pre><code>template&lt;class M&gt; class T{
      M * Array;
  public:
      T(int i) : Array(new M[i]){ }
      ~T(){ delete Array;}
  };
  </code></pre>