title: Destructor of a generic tree
body: <p>I have a generic tree:</p>
  
  <pre><code>Node{
      int information;
      vector&lt;Node*&gt; childs;
  }
  </code></pre>
  
  <p>And this is my destructor implementation:</p>
  
  <pre><code>~Node(){
      for(int i = 0; i &lt; childs.size(); i++) {
          delete childs[i];
      }
  </code></pre>
  
  <p>The problem is that I'm allowing  childs to be the same. For example: NodeA has childs B,C,B,C,C. This break the destructor implementation as B can not be deleted twice.</p>
  
  <p>What would be the best solution to this problem?</p>