vec4

Build a Vec with specified size and type deducted from arguments

  1. template vec(size_t N)
  2. alias vec2 = vec!2
  3. alias vec3 = vec!3
  4. alias vec4 = vec!4
    pure @safe nothrow @nogc
    alias vec4 = vec!4

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