title: HashTable remove function C++
body: <p>I am very new to C++ and I am working on creating a program using HashTables. This is for homework. This is the first time I am using and creating HashTables, so forgive me in advance as to I don't know entirely what I am doing. The main problem I am having right now is incorporating my <code>remove()</code> function. I can get the code to compile, but when I run test the program out, it crashes. The <strong>error</strong> that I am receiving is</p>
  
  <blockquote>
    <p>list iterator is not decrementable</p>
  </blockquote>
  
  <p>I am basing my remove function off of an insert function my professor provided us with. Just changed a few things around. Here is my class <code>HTable</code> and my <code>remove()</code> function.</p>
  
  <pre><code>class HTable
  {
  public:
      HTable(int size);
      void insert(  const string &amp;s);
      void remove(string key);
  
  private:
      vector&lt;list&lt;string&gt;&gt; List;
      int currSize;
      int tableSize;
      int hash(const string &amp;key);
      int hashFunction(string key);
      int HTableSize;
      int *status_arr;
      ostream &amp;   operator &lt;&lt;( ostream &amp;);
  };
  </code></pre>
  
  <p><code>remove()</code> function</p>
  
  <pre><code>inline void HTable::remove(string key)
  {
      list&lt;string&gt; List;
  
      if( find( List.begin( ), List.end( ), key )  ==  List.begin( ) )
      {
          List.pop_back();
      }
  }
  </code></pre>