The OpenD Programming Language

mir_rcarray

Thread safe reference counting array.

The implementation never adds roots into the GC.

Constructors

this
this(typeof(null) )
this
this(size_t length, bool initialize, bool deallocate)

Destructor

~this
~this()

Members

Aliases

serdeKeysProxy
alias serdeKeysProxy = Unqual!T

Functions

asSlice
auto asSlice()
asSlice
auto asSlice()
asSlice
auto asSlice()
length
size_t length()
moveToSlice
auto moveToSlice()
opAssign
ref opAssign(typeof(null) )
opAssign
ref opAssign(typeof(this) rhs)
opAssign
ref opAssign(ThisTemplate!Q rhs)
opCmp
int opCmp(ThisTemplate!Y rhs)
opDollar
size_t opDollar()
opEquals
bool opEquals(typeof(null) )
bool opEquals(ThisTemplate!Y rhs)
opIndex
ref opIndex(size_t i)
opIndex
inout(T)[] opIndex()
proxySwap
void proxySwap(typeof(this) rhs)
ptr
inout(T)* ptr()
toHash
size_t toHash()

Mixins

__anonymous
mixin CommonRCImpl

Variables

_payload
T* _payload;

Mixed In Members

From mixin CommonRCImpl

lightConst
ThisTemplate!(const T) lightConst()
lightImmutable
ThisTemplate!(immutable T) lightImmutable()
moveToConst
ThisTemplate!(const Unqual!T) moveToConst()
_counter
size_t _counter()
opCast
C opCast()
opCast
C opCast()

Examples

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*)));

Meta