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