auto a = RCArray!double(10); foreach(i, ref e; a) e = i; auto b = a; assert(b[$ - 1] == 9); foreach(i, ref e; b) assert(e == i); b[4] = 100; assert(a[4] == 100); import mir.ndslice.slice; auto s = a.asSlice; // as RC random access range (ndslice) static assert(is(typeof(s) == Slice!(RCI!double))); static assert(is(typeof(s) == mir_slice!(mir_rci!double))); auto r = a[]; // scope array static assert(is(typeof(r) == double[])); auto fs = r.sliced; // scope fast random access range (ndslice) static assert(is(typeof(fs) == Slice!(double*)));
Thread safe reference counting array.
The implementation never adds roots into the GC.