Vector.this

Construct a Vector from a single value

  1. this(Args args)
  2. this(V vec)
  3. this(valueType value)
    struct Vector(type, int dim)
    @safe pure nothrow
    this
    ()
    (
    valueType value
    )
    if (
    (dim >= 2) &&
    (dim <= 4)
    )

Examples

Unittest Construct a Vector from a single value

1 auto v2 = vec2( 2 );
2 assert( v2 == [ 2, 2 ] );
3 
4 auto v3i = vec3i( 3 );
5 assert( v3i == [ 3, 3, 3 ] );
6 
7 auto v4ub = vec4ub( 4 );
8 assert( v4ub == [ 4, 4, 4, 4 ] );

Meta