The OpenD Programming Language

mir_slice.opBinaryRight

Element-wise operator overloading for scalars.

struct mir_slice(Iterator_, size_t N_ = 1, SliceKind kind_ = Contiguous, Labels_...)
return scope
opBinaryRight
(
string op
T
)
(
scope return T value
)
if ()
if (
0 < N_ &&
N_ < 255
&&
!(
kind_ == Canonical &&
N_ == 1
)
&&
Labels_.length <= N_
&&
isIterator!Iterator_
)

Parameters

value T

a scalar

Return Value

Type: auto

lazy slice of the same kind and the same structure Note: Does not allocate neither new slice nor a closure.

Examples

import mir.ndslice.topology;

// 0 1 2 3
auto s = iota([4]);
// 0 1 2 0
assert(s % 3 == iota([4]).map!"a % 3");
// 0 2 4 6
assert(2 * s == iota([4], 0, 2));
import mir.ndslice.topology;

// 0 1 2 3
auto s = iota([4]);
// 0 1 4 9
assert(s ^^ 2.0 == iota([4]).map!"a ^^ 2.0");

Meta