introduce gsl::not_null<T>::element_type (#1196)

* introduce gsl::not_null<T>::element_type

* use std::is_same instead of is_same_v

* fix: cannot put a non-pointer in a gsl::not_null
This commit is contained in:
Carson Radtke 2025-02-12 09:16:05 -06:00 committed by GitHub
parent 7f4fc9388b
commit ec729d63a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 23 additions and 0 deletions

View file

@ -366,6 +366,13 @@ TEST(strict_notnull_tests, TestStrictNotNull)
}
}
TEST(pointers_test, member_types)
{
// make sure `element_type` is inherited from `gsl::not_null`
static_assert(std::is_same<gsl::strict_not_null<int*>::element_type, int*>::value,
"check member type: element_type");
}
#if defined(__cplusplus) && (__cplusplus >= 201703L)
TEST(strict_notnull_tests, TestStrictNotNullConstructorTypeDeduction)