Vector.opBinaryRight

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

  1. Vector opBinaryRight(T scalar)
  2. auto opBinaryRight(U scalar)
    struct Vector(T, uint N)
    pure const
    opBinaryRight
    (
    string op
    U
    )
    (
    const U scalar
    )
    if (
    !is(U : T) &&
    !is(CommonType!(U, T) == void)
    &&
    !op.among("~", "<<", ">>", ">>>")
    )
    if (
    N > 0
    )
  3. Vector!(CommonType!(U, T), max(N, M)) opBinaryRight(U[M] other)
  4. Vector!(T, N + 1) opBinaryRight(T scalar)
  5. Vector!(T, N + M) opBinaryRight(T[M] other)

Examples

Vec2 a = [1, 2];
assert(1 + a == [1f + 1f, 1f + 2f]);
assert(1 - a == [1f - 1f, 1f - 2f]);
assert(2 * a == [2f * 1f, 2f * 2f]);
assert(2 / a == [2f / 1f, 2f / 2f]);
assert(2 % a == [2f % 1f, 2f % 2f]);
assert(2 ^^ a == [2f ^^ 1f, 2f ^^ 2f]);

Vec2i b = [1, 2];
assert((1 & b) == [1 & 1, 1 & 2]);
assert((1 | b) == [1 | 1, 1 | 2]);
assert((1 ^ b) == [1 ^ 1, 1 ^ 2]);

Meta