The OpenD Programming Language

mir_slice.opUnary

Element-wise binary operator overloading.

struct mir_slice(Iterator_, size_t N_ = 1, SliceKind kind_ = Contiguous, Labels_...)
opUnary
(
string op
)
()
if (
op == "*" ||
op == "~"
||
op == "-"
||
op == "+"
)
if (
0 < N_ &&
N_ < 255
&&
!(
kind_ == Canonical &&
N_ == 1
)
&&
Labels_.length <= N_
&&
isIterator!Iterator_
)

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;

auto payload = [1, 2, 3, 4];
auto s = iota([payload.length], payload.ptr); // slice of references;
assert(s[1] == payload.ptr + 1);

auto c = *s; // the same as s.map!"*a"
assert(c[1] == *s[1]);

*s[1] = 3;
assert(c[1] == *s[1]);

Meta