title: List Class implementation Memory allocation error with a pointer
body: <p>So I trying to do an implementation of the List class but when trying to do the erase function I keep getting a pointer being freed was not allocated error.</p>
  
  <p>Here is the code of my function erase():</p>
  
  <pre><code>template &lt;class T&gt; void List&lt;T&gt;::erase(ListIterator&lt;T&gt; &amp; start, ListIterator&lt;T&gt; &amp; stop)
  {
      while (start&lt;= stop) {
      ListIterator&lt;T&gt; * temp = &amp;start;
      ++temp;
      delete start.currentLink;
      start.currentLink = temp-&gt;currentLink;
      }
  }
  </code></pre>
  
  <p>Now I have already tested my link and listiterator class and they work I have done everything else like insert() and push_back(). I have not been able to find out where I the memory allocation goes wrong. is any ideas that might point me in the right direction.</p>