title: Destructors and maps
body: <pre><code>class X;
  
  class Y {
      public:
          ~Y();
      private:
          map&lt;int,X*&gt; m;
          vector&lt;X*&gt; v;
          X* px;
  };
  </code></pre>
  
  <p>I guess the destructor for <code>class Y</code> should look something like this?</p>
  
  <pre><code>Y::~Y() {
      delete px; 
      for (vector&lt;X*&gt;::iterator it = v.begin(); it!=v.end(); it++) 
      delete *it;
      v.clear();
  }
  </code></pre>
  
  <p>But what about <code>Y::m</code>? </p>