Support TfHashAppend
leveraging of std::hash
for unspecialized types
#2781
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)
A C++17 friendly implementation of leveraging
std::hash
inTfHashAppend
had been left commented out. During the removal ofboost::hash
, specializations were added (#2298, #2304) for some types that explicitly forwarded the result ofstd::hash
as theirTfHashAppend
implementation.Now that OpenUSD requires C++17,
TfHashAppend
can hash any type that supportsstd::hash
and those specializations can be removed. To avoidstdext::hash_value
from being prioritized overstd::hash
on some platforms, the lookup order is reordered so thatstd::hash
is second andhash_value
is last.This also removes SFINAE for the
std::vector
specialization in favor of astatic_assert
guard against usingAppendContiguous
onstd::vector<bool>
.Fixes Issue(s)