defaultNullKeyConstantOf

Default null key of type T,

template defaultNullKeyConstantOf (
T
) {
enum defaultNullKeyConstantOf;
}

Examples

1 import std.typecons : Nullable;
2 
3 static assert(defaultNullKeyConstantOf!(void*) == null);
4 
5 alias Ni = Nullable!int;
6 static assert(defaultNullKeyConstantOf!(Ni) == Ni.init);
7 
8 // alias cNi = const(Nullable!int);
9 // static assert(defaultNullKeyConstantOf!(cNi) == cNi.init);
10 
11 alias NubM = Nullable!(ubyte, ubyte.max);
12 assert(defaultNullKeyConstantOf!(NubM).isNull);
13 
14 alias NuiM = Nullable!(uint, uint.max);
15 assert(defaultNullKeyConstantOf!(NuiM).isNull);
16 
17 const Nullable!(uint, uint.max) x = 13;
18 assert(!x.isNull);
19 const y = x;
20 assert(!y.isNull);
21 assert(!x.isNull);

Meta