forked from microsoft/GSL
fix requirement on not_null template
it should be comparable to nullptr, it does not have to be assignable
This commit is contained in:
@@ -69,7 +69,7 @@ template <class T>
|
|||||||
class not_null
|
class not_null
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static_assert(std::is_assignable<T&, std::nullptr_t>::value, "T cannot be assigned nullptr.");
|
static_assert(std::is_convertible<decltype(std::declval<T>() != nullptr), bool>::value, "T cannot be compared to nullptr.");
|
||||||
|
|
||||||
template <typename U, typename = std::enable_if_t<std::is_convertible<U, T>::value>>
|
template <typename U, typename = std::enable_if_t<std::is_convertible<U, T>::value>>
|
||||||
constexpr explicit not_null(U&& u) : ptr_(std::forward<U>(u))
|
constexpr explicit not_null(U&& u) : ptr_(std::forward<U>(u))
|
||||||
|
Reference in New Issue
Block a user