vec

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

  1. auto vec(Comps comps)
    template vec(T)
    pure @safe nothrow @nogc
    vec
    (
    Comps...
    )
    (
    Comps comps
    )
    if (
    Comps.length > 0 &&
    !(
    Comps.length == 1 &&
    isStaticArray!(Comps[0])
    )
    )
    if (
    isNumeric!T
    )
  2. auto vec(ArrT arr)
  3. auto vec(Comps comps)
  4. auto vec(Arr arr)
  5. template vec(size_t N)

Members

Functions

vec
auto vec(Comps comps)
Undocumented in source. Be warned that the author may not have intended to support it.
vec
auto vec(ArrT arr)
Undocumented in source. Be warned that the author may not have intended to support it.

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