Inserting into a HashTable
<p>So, I'm really at a lost here. I'm having a really difficult time trying to insert a item into a hash table, <code>insert(const Entry&amp; e)</code> I posted my most recent attempt below, I know it's not much, but as of now it's all I got. Any push in the right direction is very appreciated.
My structure and class definition should be fine as is.</p>

<p>Currently getting, </p>

<blockquote>
  <p>hTable.cc: In member function ‘void HT::insert(const Entry&amp;)’:</p>
  
  <p>hTable.cc:38:19: error: no match for ‘operator=’</p>
</blockquote>

<p>Error is happening when I do, <code>hTable[hashVal] = new Entry(e);</code></p>

<p>and</p>

<blockquote>
  <p>hTable.cc:37:57:   required from here</p>
  
  <p>/usr/include/c++/5/bits/predefined_ops.h:234:30: error: expression cannot be </p>
  
  <p>used as a function</p>
  
  <p>{ return bool(_M_pred(*__it)); }</p>
</blockquote>

<p>Second error is coming from the same line where I use <code>find_if()</code>, I assume it has to do with how I used <code>hashVal</code>? I did look up <code>find_if()</code>, but a lot of the explanations didn't make much sense to me.</p>

<p>Below is my structure, for the entry in the table (Entry.h)</p>

<pre><code>#ifndef H_ENTRY
#define H_ENTRY

#include &lt;string&gt;
using namespace std;

#define ID_SZ      3    // size of key
#define ITEM_SZ    24   // max size for item description 
#define TBL_SZ     31   // default size for hash table

struct Entry {
    string key,   // key
           desc;  // description
    unsigned num; // no of copies

    //constructor
    Entry ( const string&amp; k = "", const string&amp; d = "",
        const unsigned&amp; n = 0 ) : key ( k ), desc ( d ),
        num ( n ) { }
};
#endif
</code></pre>

<p>Below is my class definition for my hash table (hTable.h)</p>

<pre><code>#include "Entry.h"
#ifndef H_HASH_TABLE
#define H_HASH_TABLE

#include &lt;algorithm&gt;
#include &lt;iomanip&gt;
#include &lt;iostream&gt;
#include &lt;list&gt;
#include &lt;vector&gt;

class HT {
public:
    HT ( const unsigned&amp; = TBL_SZ );   // constructor
    ~HT ( );                           // destructor
    void insert ( const Entry&amp; );      // inserts item in hash table
private:
    unsigned hsize;                    // size of hash table
    vector &lt; list &lt; Entry &gt; &gt;  hTable; // hash table
    vector &lt; Entry* &gt; pTable;          // ptr table
    int hash ( const string&amp; );        // hash function
};
#endif
</code></pre>

<p>Below is my hTable.cc, where my problem is.</p>

<pre><code>#include "hTable.h"

HT::~HT() {
        for (unsigned i = 0; i &lt; hsize; i++)
                        hTable.pop_back();
}
HT::HT(const unsigned&amp; hs) {
        hTable.resize(hs);
        pTable.resize(hs);
}
void HT::insert(const Entry&amp; e) {
//if key already exists, print out message saying so.
//else, insert into hash table
        //also inserts the address of the record (in the hash table) into the pointer table

    int hashVal = hash(e.key);

    if( find_if( hTable.begin(), hTable.end(), hashVal) == hTable.end() )
            hTable[hashVal] = new Entry(e);
    else
            cout &lt;&lt; "\ntemp message\n";

}
</code></pre>