How do I check if a type is assignable to null at compile time?

Murilo murilomiranda92 at hotmail.com
Fri Feb 26 23:37:18 UTC 2021


On Friday, 26 February 2021 at 05:25:14 UTC, Jack wrote:
> I started with:
>
> enum isAssignableNull(T) = is(T : Object) || isPointer(T);
>
> but how do I cover all cases?

You can check if it's null with this `variable is null` and you
can test it with assert as in `assert(variable is null);`


More information about the Digitalmars-d-learn mailing list