The OpenD Programming Language

RCI

Thread safe reference counting iterator.

import mir.rc.array;
alias RCI = mir_rci

Examples

import mir.ndslice.traits: isIterator;
import mir.ndslice.slice;
import mir.rc.array;
auto slice = mir_rcarray!double(10).asSlice;
static assert(isIterator!(RCI!double));
static assert(is(typeof(slice) == Slice!(RCI!double)));
auto matrix = slice.sliced(2, 5);
static assert(is(typeof(matrix) == Slice!(RCI!double, 2)));
slice[7] = 44;
assert(matrix[1, 2] == 44);
import mir.ndslice.slice;
import mir.rc.array;

alias rcvec = Slice!(RCI!double);

RCI!double a, b;
a = b;

RCI!(const double) ca, cb;
ca = cb;
ca = cast(const) cb;

void foo(scope ref rcvec x, scope ref rcvec y)
{
    x[] = y[];
    x[1] = y[1];
    x[1 .. $] += y[1 .. $];
    x = x.save;
}

Meta