ivec

Build a Vec with specified component type T and size deducted from arguments.

  1. template vec(T)
  2. alias dvec = vec!double
  3. alias fvec = vec!float
  4. alias ivec = vec!int
    pure @safe nothrow @nogc
    alias ivec = vec!int

Examples

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

immutable v1 = dvec (1, 2, 4, 0); // none of the args 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 = fvec(arr2);
static assert( is(Unqual!(typeof(v2)) == FVec3) );
assert(equal(v2.data, arr2[]));

immutable int[4] arr3 = [0, 1, 2, 3];
immutable v3 = dvec (1, 2);
immutable v4 = dvec (0, v3, 3);
static assert( is(Unqual!(typeof(v4)) == DVec4) );
assert(equal(v4.data, arr3[]));

Meta