vec

Build a Vec with specified size and type deducted from arguments

  1. auto vec(Arr arr)
    template vec(size_t N)
    pure @safe nothrow @nogc
    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.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