Fix std::hash compilation error for gsl::not_null<std::shared_ptr<T>>#1210
Merged
carsonRadtke merged 6 commits intomainfrom Dec 5, 2025
Merged
Fix std::hash compilation error for gsl::not_null<std::shared_ptr<T>>#1210carsonRadtke merged 6 commits intomainfrom
carsonRadtke merged 6 commits intomainfrom
Conversation
Copilot
AI
changed the title
[WIP] Compilation error with std::hash<gsl::not_null<std::shared_ptr<T>>> in GSL 4.2.0
Fix std::hash compilation error for gsl::not_null<std::shared_ptr<T>>
Jun 2, 2025
Contributor
There was a problem hiding this comment.
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. |
carsonRadtke
requested changes
Jul 26, 2025
carsonRadtke
approved these changes
Dec 4, 2025
Member
|
@copilot Can you rebase these changes onto main so the tests actions re-run? |
Contributor
Author
carsonRadtke
requested changes
Dec 4, 2025
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
gdr-at-ms
approved these changes
Dec 5, 2025
carsonRadtke
approved these changes
Dec 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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.