-
Notifications
You must be signed in to change notification settings - Fork 762
Fix std::hash compilation error for gsl::not_null<std::shared_ptr<T>> #1210
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the compilation error related to the specialization of std::hash for gsl::not_null<std::shared_ptr> by changing the template deduction from decltype(.get()) to use typename T::element_type.
- Update not_null_hash template in include/gsl/pointers to correctly deduce the type.
- Add new tests in tests/notnull_tests.cpp to verify correct behavior of std::hash with not_null.
- Ensure compatibility with both C++14 and C++20 standards.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/notnull_tests.cpp | Added test cases to validate correct hashing behavior for not_null<std::shared_ptr>. |
| include/gsl/pointers | Updated the not_null_hash template to use typename T::element_type for proper type deduction. |
|
@copilot Can you rebase these changes onto main so the tests actions re-run? |
Co-authored-by: carsonRadtke <10507970+carsonRadtke@users.noreply.github.com>
…null_hash Co-authored-by: carsonRadtke <10507970+carsonRadtke@users.noreply.github.com>
Co-authored-by: carsonRadtke <10507970+carsonRadtke@users.noreply.github.com>
3a73cc7 to
6b49c57
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
All changes have been successfully rebased onto the latest main branch and unnecessary file has been removed.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.