
On 18 February 2011 19:40, Stewart, Robert <Robert.Stewart@sig.com> wrote:
The following is a program that demonstrates that a null shared_ptr<int> produces a hash value of zero and that (ostensibly) all non-null instances produce a hash value of one.
This is known, it happens because shared_ptr can be implicitly cast to bool, so it uses that. If you set BOOST_HASH_NO_IMPLICIT_CASTS it won't happen. This macro isn't set by default because I'm not sure if there will be any other consequences from preventing implicit casts, but it might be in a future version.
I expected that there'd be a shared_ptr specialization of hash_value to make it work right, but I don't find one. Shouldn't there be one?
That's an issue for the shared_ptr implementation. Daniel