Vector

Generic Vector backed by a static array.

Constructors

this
this(T scalar)

Constructs a Vector with all elements equal to scalar

this
this(T[N] values)

Constructs a Vector from static array.

this
this(R range)

Constructs a Vector with elements from an Input Range. Values not provided by range are initialized to 0, while additional values are ignored.

this
this(U value)

Constructs a Vector from a Vector-like struct.

this
this(Args args)

Constructs a Vector with all elements initialized separately

Alias This

elements

Members

Aliases

ElementType
alias ElementType = T

Alias for Vector element type.

a
alias a = w

Get a reference to fourth element.

b
alias b = z

Get a reference to third element.

ba
alias ba = zw

Get a reference to the third and fourth elements.

depth
alias depth = z

Get a reference to third element.

g
alias g = y

Get a reference to second element.

gb
alias gb = yz

Get a reference to the second and third elements.

gba
alias gba = yzw

Get a reference to the second, third and fourth elements.

height
alias height = y

Get a reference to second element.

p
alias p = z

Get a reference to third element.

pq
alias pq = zw

Get a reference to the third and fourth elements.

q
alias q = w

Get a reference to fourth element.

r
alias r = x

Get a reference to first element.

rg
alias rg = xy

Get a reference to the first and second elements.

rgb
alias rgb = xyz

Get a reference to the first, second and third elements.

rgba
alias rgba = xyzw

Get a reference to the first, second, third and fourth elements.

s
alias s = x

Get a reference to first element.

st
alias st = xy

Get a reference to the first and second elements.

stp
alias stp = xyz

Get a reference to the first, second and third elements.

stpq
alias stpq = xyzw

Get a reference to the first, second, third and fourth elements.

t
alias t = y

Get a reference to second element.

tp
alias tp = yz

Get a reference to the second and third elements.

tpq
alias tpq = yzw

Get a reference to the second, third and fourth elements.

u
alias u = x

Get a reference to first element.

uv
alias uv = xy

Get a reference to the first and second elements.

v
alias v = y

Get a reference to second element.

w
alias w = _get!(3)

Get a reference to fourth element.

width
alias width = x

Get a reference to first element.

x
alias x = _get!(0)

Get a reference to first element.

xy
alias xy = _slice!(0, 2)

Get a reference to the first and second elements.

xyz
alias xyz = _slice!(0, 3)

Get a reference to the first, second and third elements.

xyzw
alias xyzw = _slice!(0, 4)

Get a reference to the first, second, third and fourth elements.

y
alias y = _get!(1)

Get a reference to second element.

yz
alias yz = _slice!(1, 3)

Get a reference to the second and third elements.

yzw
alias yzw = _slice!(1, 4)

Get a reference to the second, third and fourth elements.

z
alias z = _get!(2)

Get a reference to third element.

zeroes
alias zeroes = zeros
Undocumented in source.
zw
alias zw = _slice!(2, 4)

Get a reference to the third and fourth elements.

Functions

_get
inout(T) _get()
Undocumented in source.
_slice
inout(T[to - from]) _slice()
Undocumented in source.
opBinary
Vector opBinary(T scalar)
auto opBinary(U scalar)

Returns a new vector with binary operator applied to all elements and scalar

opBinary
Vector!(T, max(N, M)) opBinary(T[M] other)
Vector!(CommonType!(U, T), max(N, M)) opBinary(U[M] other)

Returns a new vector with the results of applying operator against elements of other. If operands dimensions are unequal, copies the values from greater dimension vector.

opBinary
Vector!(T, N + 1) opBinary(T scalar)

Returns a new vector of greater dimension by copying elements and appending scalar.

opBinary
Vector!(T, N + M) opBinary(T[M] other)

Returns a new vector of greater dimension by copying elements and appending values from other.

opBinaryRight
Vector opBinaryRight(T scalar)
auto opBinaryRight(U scalar)

Returns a new vector with binary operator applied to all elements and scalar

opBinaryRight
Vector!(CommonType!(U, T), max(N, M)) opBinaryRight(U[M] other)

Returns a new vector with the results of applying operator against elements of other. If operands dimensions are unequal, copies the values from greater dimension vector.

opBinaryRight
Vector!(T, N + 1) opBinaryRight(T scalar)

Returns a new vector of greater dimension by copying elements and prepending scalar.

opBinaryRight
Vector!(T, N + M) opBinaryRight(T[M] other)

Returns a new vector of greater dimension by copying elements and prepending values from other.

opCast
U opCast()

Cast to a static array of same dimension, but different element type.

opCast
U opCast()

Cast to a Vector-like struct.

opOpAssign
Vector opOpAssign(T scalar)

Assign result of applying operator with scalar to elements.

opOpAssign
Vector opOpAssign(T[M] other)

Assign result of applying operator with other to elements.

opUnary
Vector opUnary()

Returns a new vector with unary operator applied to all elements

Manifest constants

dimension
enum dimension;

Vector dimension.

Variables

elements
T[N] elements;

Element array.

ones
enum Vector ones;

Vector with all ones

zeros
enum Vector zeros;

Vector with all zeros

Parameters

T

Element type

N

Vector dimension, must be positive

Meta