The OpenD Programming Language

mir.rc

Thread-safe reference-counted arrays and pointers

Mir provides two kinds of ref-counting pointers and two kinds of ref-counted arrays.

The first kind pointer is RCPtr, which consists of a pointer to the context and pointer to the value.RCPtr supports structural and object polymorphism. It allows getting members with the same context as the root. The second kind is SlimRCPtr, which consist only from a pointer to the value. The context for SlimRCPtris computed using a fixed-length memory shift from the pointer to the value. SlimRCPtr can be converted to an RCPtr and to an RCArray of the one element.

RCArray is an array type without range primitives. It's length can't be reduced after construction.In the other hand, Slice!(RCI!(T)) is an ndslice with all random-access range primitives.RCI is an iterator, which consists of RCArray and the pointer to the current element. RCArray!T can be converted or moved to Slice!(RCI!(T)) using .asSlice or .moveToSlice methods respectively.

RCArray!T aliases itself to a common D array slice. This feature may cause a segmentation fault in safe code if used without DIP1000.

RCPtr!T can be constructed from an element index and RCArray!T / Slice!(RCI!(T)).

The package publicly imports mir.rc.array, mir.rc.ptr, and mir.rc.slim_ptr.

Modules

array
module mir.rc.array
Thread-safe reference-counted arrays and iterators

.

context
module mir.rc.context
Thread-safe reference-counted context implementation

.

ptr
module mir.rc.ptr
Thread-safe reference-counted shared pointers

.

slim_ptr
module mir.rc.slim_ptr
Thread-safe slim reference-counted shared pointers

.

Public Imports

mir.rc.array
public import mir.rc.array;
mir.rc.ptr
public import mir.rc.ptr;
mir.rc.slim_ptr
public import mir.rc.slim_ptr;

Members

Functions

toRCArray
RCArray!F toRCArray(SlimRCPtr!F context)
toRCPtr
RCPtr!F toRCPtr(SlimRCPtr!F contextAndValue)
toRCPtrAt
RCPtr!F toRCPtrAt(RCArray!F array, size_t index)
RCPtr!F toRCPtrAt(Slice!(RCI!F) array, size_t index)

See Also

Meta