On Friday, 26 February 2021 at 05:34:26 UTC, Paul Backus wrote:
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?

Something like this should work:

enum isAssignableNull(T) = __traits(compiles, (T t) => t = null);

`isAssignableNull!(immutable void*)` is true with his definition but false with yours. Of course you are correct that you cannot assign to an immutable pointer.

Reply via email to