alias Float = Variant!(float, double); alias Int = Variant!(long, int); alias Number = Variant!(Float.AllowedTypes, Int.AllowedTypes); Float fp = 3.0; Number number = fp; // constructor call assert(number == 3.0); Int integer = 12L; number = Number(integer); assert(number == 12L);
Construct an algebraic type from its subset.