vec2

Build a Vec with specified size and type deducted from arguments

pure @safe nothrow @nogc
alias vec2 = vec!2

Examples

import std.algorithm : equal;
import std.array : staticArray;
import std.traits : Unqual;

const double[4] arr1 = [1, 2, 4, 0];
const v1 = vec4 (arr1[]);            // passing slice to erase compile-time length
static assert( is(Unqual!(typeof(v1)) == DVec4) );
assert(equal(v1.data, arr1[]));

const int comp = 2;
const v2 = vec4 (comp);
static assert( is(Unqual!(typeof(v2)) == IVec4) );
assert(equal(v2.data, staticArray([2, 2, 2, 2])[]));

Meta