From aa97c20ddfd75435fc863d49d65408f622b18c31 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Jun 2025 19:48:09 +0000 Subject: [PATCH 1/6] Initial plan for issue From 718bdb125657bae43a6cfa0f0680fc6ba31161f1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Jun 2025 19:54:22 +0000 Subject: [PATCH 2/6] Fix hash compilation issue for gsl::not_null with shared_ptr Co-authored-by: carsonRadtke <10507970+carsonRadtke@users.noreply.github.com> --- include/gsl/pointers | 2 +- tests/notnull_tests.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/gsl/pointers b/include/gsl/pointers index 5e69f589e..2a032ab2d 100644 --- a/include/gsl/pointers +++ b/include/gsl/pointers @@ -231,7 +231,7 @@ template not_null operator+(std::ptrdiff_t, const not_null&) = delete; -template ().get()), bool = std::is_default_constructible>::value> +template >::value> struct not_null_hash { std::size_t operator()(const T& value) const { return std::hash{}(value.get()); } diff --git a/tests/notnull_tests.cpp b/tests/notnull_tests.cpp index 56b549b81..4fa48b0bf 100644 --- a/tests/notnull_tests.cpp +++ b/tests/notnull_tests.cpp @@ -735,4 +735,18 @@ TEST(notnull_tests, TestStdHash) EXPECT_FALSE(hash_nn(nn) == hash_intptr(&y)); EXPECT_FALSE(hash_nn(nn) == hash_intptr(nullptr)); } + + { + auto x = std::make_shared(42); + auto y = std::make_shared(99); + not_null> nn{x}; + const not_null> cnn{x}; + + std::hash>> hash_nn; + std::hash> hash_sharedptr; + + EXPECT_TRUE(hash_nn(nn) == hash_sharedptr(x)); + EXPECT_FALSE(hash_nn(nn) == hash_sharedptr(y)); + EXPECT_TRUE(hash_nn(cnn) == hash_sharedptr(x)); + } } From 3e67ae6cfed0ad7ff7794a502f08bff7ba71b6eb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 26 Jul 2025 03:12:56 +0000 Subject: [PATCH 3/6] Add comment explaining safe usage of typename T::element_type in not_null_hash Co-authored-by: carsonRadtke <10507970+carsonRadtke@users.noreply.github.com> --- include/gsl/pointers | 1 + 1 file changed, 1 insertion(+) diff --git a/include/gsl/pointers b/include/gsl/pointers index 2a032ab2d..282229fe8 100644 --- a/include/gsl/pointers +++ b/include/gsl/pointers @@ -231,6 +231,7 @@ template not_null operator+(std::ptrdiff_t, const not_null&) = delete; +// T is conceptually a pointer so we don't have to worry about it being a reference and violating std::hash requirements template >::value> struct not_null_hash { From a956a66df2b858c7f61f039b71f3c56f78460477 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Jun 2025 19:48:09 +0000 Subject: [PATCH 4/6] Initial plan for issue From aea441302f743bccdb57a113b25a3b7fc6dd7230 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 4 Dec 2025 22:35:58 +0000 Subject: [PATCH 5/6] Remove upgrade_checklist.md file as requested Co-authored-by: carsonRadtke <10507970+carsonRadtke@users.noreply.github.com> --- docs/upgrade_checklist.md | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 docs/upgrade_checklist.md diff --git a/docs/upgrade_checklist.md b/docs/upgrade_checklist.md deleted file mode 100644 index bf923b3df..000000000 --- a/docs/upgrade_checklist.md +++ /dev/null @@ -1,19 +0,0 @@ -> When bumping the version, you need to update the following files: - -1. [ ] [CMakeLists.txt](../CMakeLists.txt) Bump `GSL_VERSION` -1. [ ] [README.md](../README.md) Bump `GIT_TAG` -1. [ ] [ios.yml](../.github/workflows/ios.yml) Bump `MACOSX_BUNDLE_BUNDLE_VERSION` and -`MACOSX_BUNDLE_SHORT_VERSION_STRING` - -> After updating, you need to create a new GitHub release: - -1. [ ] [Microsoft/GSL - Create Release](https://github.com/microsoft/GSL/releases/new) - -Be sure to update the release notes accordingly and properly mention open-source -contributors. - -> After a new release exists, update the `ms-gsl` vcpkg port: - -1. [ ] [Microsoft/vcpkg - ms-gsl port](https://github.com/microsoft/vcpkg/tree/master/ports/ms-gsl) - -Be sure to monitor the PR that updates the port for any feedback from vcpkg maintainers. From 6b49c57dbb08fb24d814767e7bee59f00aa03cfc Mon Sep 17 00:00:00 2001 From: Carson Radtke Date: Fri, 5 Dec 2025 08:47:30 -0700 Subject: [PATCH 6/6] restore docs/upgrade_checklist.md --- docs/upgrade_checklist.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 docs/upgrade_checklist.md diff --git a/docs/upgrade_checklist.md b/docs/upgrade_checklist.md new file mode 100644 index 000000000..bf923b3df --- /dev/null +++ b/docs/upgrade_checklist.md @@ -0,0 +1,19 @@ +> When bumping the version, you need to update the following files: + +1. [ ] [CMakeLists.txt](../CMakeLists.txt) Bump `GSL_VERSION` +1. [ ] [README.md](../README.md) Bump `GIT_TAG` +1. [ ] [ios.yml](../.github/workflows/ios.yml) Bump `MACOSX_BUNDLE_BUNDLE_VERSION` and +`MACOSX_BUNDLE_SHORT_VERSION_STRING` + +> After updating, you need to create a new GitHub release: + +1. [ ] [Microsoft/GSL - Create Release](https://github.com/microsoft/GSL/releases/new) + +Be sure to update the release notes accordingly and properly mention open-source +contributors. + +> After a new release exists, update the `ms-gsl` vcpkg port: + +1. [ ] [Microsoft/vcpkg - ms-gsl port](https://github.com/microsoft/vcpkg/tree/master/ports/ms-gsl) + +Be sure to monitor the PR that updates the port for any feedback from vcpkg maintainers.