title: clearing a vector of pointers
body: <p>Assume I have defined a class like this:</p>
  
  <pre><code> class foo {
   private: 
      std::vector&lt; int* &gt; v;
   public:
      ...
      void bar1()
      {
         for (int i = 0; i &lt; 10; i++) {
           int *a = new int;
           v.push_back( a );
         }
      };
  
      void bar2()
      {
         std::vector&lt; int &gt;::iterator it = v.begin();
         for ( ; it != v.end(); it++ )  
           std::cout &lt;&lt; (*it);
         v.clear();
      }
   };
  </code></pre>
  
  <p>In short, I push back some pointers in a vector, later I clear the vector. The question is, does this code has memory leak? I mean by clearing the vector, are the pointers deleted properly?</p>