diff --git a/include/gsl/pointers b/include/gsl/pointers index 42e8c09..2f1b15f 100644 --- a/include/gsl/pointers +++ b/include/gsl/pointers @@ -32,6 +32,15 @@ namespace gsl { +namespace details +{ +template +struct is_comparable_to_nullptr : std::false_type {}; + +template +struct is_comparable_to_nullptr() != nullptr), bool>::value>> : std::true_type {}; +} // namespace details + // // GSL.owner: ownership pointers // @@ -68,8 +77,7 @@ template class not_null { public: - static_assert(std::is_convertible() != nullptr), bool>::value, - "T cannot be compared to nullptr."); + static_assert(details::is_comparable_to_nullptr::value, "T cannot be compared to nullptr."); template ::value>> constexpr not_null(U&& u) : ptr_(std::forward(u))