Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specialize TfHashAppend for std::vector<bool> #2298

Merged
merged 1 commit into from
Mar 2, 2023

Conversation

nvmkuruc
Copy link
Collaborator

@nvmkuruc nvmkuruc commented Feb 18, 2023

Description of Change(s)

The TfHashAppend specialization for std::vector uses the .data() method to hash contiguous elements. However, std::vector<bool> is not guaranteed to provide a .data() method and does not guarantee the underlying data's length is the container's size() * sizeof(bool).

This change modifies the TfHashAppend specialization to not match against std::vector<bool> and provides a more explicit specialization that uses std::hash instead.

This issue was detected during testing of #2176 which changes VtHash to prefer TfHash over hash_value for hashing.

Fixes Issue(s)

  • I have verified that all unit tests pass with the proposed changes
  • I have submitted a signed Contributor License Agreement

@tallytalwar
Copy link
Contributor

Filed as internal issue #USD-8039

@pixar-oss pixar-oss merged commit 8200f1b into PixarAnimationStudios:dev Mar 2, 2023
@nvmkuruc nvmkuruc deleted the tfvectorboolhash branch March 2, 2023 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants