1 import std.typecons : Nullable; 2 3 class C {} 4 5 static assert( isNullable!(C)); 6 static assert( isNullable!(int*)); 7 static assert( isNullable!(int[])); 8 static assert( isNullable!(const(int)[])); 9 static assert(!isNullable!(int[3])); 10 static assert( isNullable!(string)); 11 static assert( isNullable!(Nullable!int)); 12 static assert(!isNullable!(int)); 13 14 struct S 15 { 16 int value; 17 static immutable nullValue = typeof(this).init; 18 } 19 20 struct S2 { C x, y; } 21 static assert(!isNullable!S2); 22 23 struct S3 { int x, y; } 24 static assert(!isNullable!S3); 25 26 struct S4 { C x, y; alias nullifier = x; } 27 static assert(isNullable!S4);
Is true iff T is type with a predefined undefined (null) value.