I am working with a Hashtable in C++. The hash function:
// Default hash function class
template <typename K>
struct KeyHash {
unsigned long operator()(const K& key) const {
return reinterpret_cast<unsigned long>(key) % TABLE_SIZE;
}
};
Then when I declared hashtable as:
HashTable<int, std::string> hmap;
Its showing:
Invalid cast from 'int' type to 'unsigned_long_int'
Whats the problem with reinterpret_cast<unsigned long>
here?