vec

Build a Vec with specified size and type deducted from arguments

  1. auto vec(Arr arr)
    template vec(size_t N)
    vec
    (
    Arr
    )
    (
    in Arr arr
    )
    if (
    isDynamicArray!Arr
    )
  2. auto vec(T comp)
  3. auto vec(Comps comps)
  4. auto vec(Arr arr)
  5. template vec(T)

Members

Functions

vec
auto vec(Arr arr)
Undocumented in source.
vec
auto vec(T comp)
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

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

const double[] arr = [1, 2, 4, 0];  // arr.length known at runtime
const v1 = vec4 (arr);             // asserts that arr.length == 4
static assert( is(Unqual!(typeof(v1)) == DVec4) );
assert(equal(v1.data, [1, 2, 4, 0]));

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

Meta