Re: [boost] Re: [review results] hash functions accepted

In-Reply-To: <004c01c52edb$d07ee5e0$6501a8c0@pdimov2> pdimov@mmltd.net (Peter Dimov) wrote (abridged):
Is it worth considering using x + x / sizeof(*p) instead?
This will not work for incomplete types, including void.
Good point :-)
I'd prefer equal hash_values for an incomplete T*, complete T*, and void* with the same value.
Indeed. Presumably this means casting to void* eg for the case where sizeof(void*) != sizeof(char *).
We'll lose one potential bit of enthropy when alignof(x) == 16, but this seems sufficiently rare in practice.
I was a bit concerned about cases where the heap produces a de facto alignment. Especially if there is a different pool for each size of object, or a user-defined X::operator new() that allocates from a huge array of X. I guess it can't be helped. -- Dave Harris, Nottingham, UK
participants (1)
-
brangdon@cix.compulink.co.uk