
20 Mar
2006
20 Mar
'06
10:21 p.m.
Daniel James wrote:
Peter Dimov wrote:
For larger integer types, we probably need something along the lines of
std::size_t hash_value( val ) { size_t r = val;
while( val >>= size_t_bits ) { hash_combine( r, (size_t)val ); }
return r; }
It has the property of preserving the hash_value of all _values_ that can fit into a size_t, even though the underlying type is capable of holding bigger integers.
I don't think it does.
Actually, it does for positive number. Sorry I misread it. What you were doing clicked a couple of seconds after I clicked on 'send'. But I'm not sure it works for negative numbers. Daniel