title: How to destroy a vector of pointers in c++?
body: <p>I have the following code in one of my methods:</p>
  
  <pre><code>vector&lt;Base*&gt; units;
  Base *a = new A();
  Base *b = new B();
  units.push_back(a);
  units.push_back(b);
  </code></pre>
  
  <p>Should I destroy the a and b pointers before I exit the method?
  Or should I somehow just destroy the units vector of pointers?</p>
  
  <p>Edit 1:</p>
  
  <p>This is another interesting case:</p>
  
  <pre><code>vector&lt;Base*&gt; units;
  A a;
  B b;        
  units.push_back(&amp;a);
  units.push_back(&amp;b);
  </code></pre>
  
  <p>What about this case? Now I don't have to use delete nor smart pointers.</p>
  
  <p>Thanks</p>