Enum member isNullSettable

Returns true of T can be set to null

enum isNullSettable(T...) = __traits(compiles, () { U u = U.init; u = null; } );


class C {}
struct S1 {
    void opAssign(int*) {}
static assert(isNullSettable!S1);
static assert(isNullSettable!C);
static assert(isNullSettable!(int*));

struct S2 {}
static assert(!isNullSettable!S2);
static assert(!isNullSettable!int);

struct S3 {
    @disable this();
    void opAssign(int*) {}
static assert(isNullSettable!S3);

Returns a stringof another template with it's real and non-mangled types

You may also customize the format in the case of templates:

struct S(T, U) {