Specialize TfHashAppend
for std::shared_ptr
and std::unique_ptr
#2304
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Change(s)
TfHash
andVtHash
may utilize ADL ofhash_value
for their hashing implementations. As usage ofboost::hash_value
is being phased out, it's possible for otherhash_value
implementations to be picked up. Specifically, while testing the removal ofboost::hash_value
frompxr/base/vt/hash.h
(#2176),stdext::hash_value
was getting discovered on certain Windows builds when hashingstd::shared_ptr
.boost::hash_value
was previously providing thestd::shared_ptr
specialization forVtHash
but with #2176VtHash
prefersTfHash
andTfHash
may resolve to thestdext::hash_value
implementation.This PR provides an implementation of
TfHashAppend
forstd::shared_ptr
andstd::unique_ptr
which hash their underlying pointers and takes precedence overhash_value
.While providing a
TfHashAppend
implementation forstd::shared_ptr
andstd::unique_ptr
precludeshash_value
ADL, it's worth noting that for user code usingVtHash
orTfHash
, other types may be affected by this and additional specializations may be required.This should not affect the specialization of
TfHashAppend
forstd::shared_ptr<_Untyped>
used inpxr/usd/ar
which hashes the pointed to value instead of the pointer.Fixes Issue(s)
TfHash
toboost::hash
#2172