import std.algorithm : equal; import std.traits : Unqual; immutable v1 = vec (1, 2, 4.0, 0); // CommonType!(int, double) is double immutable int[4] arr1 = [1, 2, 4, 0]; static assert( is(Unqual!(typeof(v1)) == DVec4) ); assert(equal(v1.data, arr1[])); immutable int[3] arr2 = [0, 1, 2]; immutable v2 = vec (arr2); static assert( is(Unqual!(typeof(v2)) == IVec3) ); assert(equal(v2.data, arr2[]));
Build a Vec whose component type and size is deducted from arguments.