title: Delete a whole List in C++
body: <p>I have found online a very simple List class. In my program I have created a list of a specific type and used it for some calculations. Now I want to use the same list (same type of list) and use it for other things. To make things clearer:</p>
  
  <pre><code>List&lt;Vertex*&gt; vertices;
  List&lt;Triangle*&gt; triangles;
  </code></pre>
  
  <p>I am adding info in these lists using two functions:</p>
  
  <pre><code>void AddVertex(List&lt;Vector&gt; &amp;vertex)
  void AddFaces(List&lt;triangle_data&gt; &amp;f)
  </code></pre>
  
  <p>These are the two basic lists I'm using. Now I want to use the same lists for other vertices and triangles (different model). So how am I supposed to "delete" everything inside the two lists and use them with different vertices and triangles?</p>
  
  <p>This is the typical list.h I am using:</p>
  
  <pre><code>template &lt;class Type&gt; class List {
  public:
              List(int s=0);
              ~List();
      void    allocate(int s);
      void    SetSize(int s);
      void    Pack();
      void    Add(Type);
      void    AddUnique(Type);
      int     Contains(Type);
      void    Remove(Type);
      void    DelIndex(int i);
      Type *  element;
      int     num;
      int     array_size;
      Type    &amp;operator[](int i){assert(i&gt;=0); assert(i&lt;num); return element[i];}
  }
  </code></pre>