Mark gsl::not_null swap noexcept (#1235)

Co-authored-by: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>
This commit is contained in:
maflcko
2026-03-23 12:16:36 -06:00
committed by GitHub
co-authored by MarcoFalke
parent 5ca9c77666
commit 9f9f65c7e2
2 changed files with 6 additions and 2 deletions
+4
View File
@@ -43,6 +43,8 @@ TEST(pointers_test, swap)
gsl::not_null<std::unique_ptr<int>> a(std::make_unique<int>(0));
gsl::not_null<std::unique_ptr<int>> b(std::make_unique<int>(1));
static_assert(noexcept(gsl::swap(a, b)), "not null unique_ptr should be noexcept-swappable");
EXPECT_TRUE(*a == 0);
EXPECT_TRUE(*b == 1);
@@ -62,6 +64,8 @@ TEST(pointers_test, swap)
gsl::strict_not_null<std::unique_ptr<int>> a{std::make_unique<int>(0)};
gsl::strict_not_null<std::unique_ptr<int>> b{std::make_unique<int>(1)};
static_assert(noexcept(gsl::swap(a, b)), "strict not null unique_ptr should be noexcept-swappable");
EXPECT_TRUE(*a == 0);
EXPECT_TRUE(*b == 1);