WeakReferenceArray

Implements weak reference array.

It gives better performance when working with multiple weak references at once.

Constructors

this
this(size_t initialCapacity)

Create weak reference array with initial capacity initialCapacity.

Destructor

~this
~this()
Undocumented in source.

Members

Functions

makeHard
void makeHard()

Force the array to behave as a hard reference.

makeWeak
void makeWeak()

Force the array to behave as a weak reference.

opIndex
inout(T) opIndex(size_t i)

Returns i-th referenced object if it isn't finalized thus creating a strong reference to it. Returns null otherwise.

opIndexAssign
void opIndexAssign(T target, size_t i)

Changes i-th referenced object.

opOpAssign
void opOpAssign(T target)

Appends new weak reference to target to the array.

removeDead
void removeDead()

Remove dead weak references from the array. This may decrease count.

reserve
void reserve(size_t newCapacity)

Reserve at least newCapacity elements for appending.

Properties

aliveCount
size_t aliveCount [@property getter]

Total count of alive weak references.

buff
inout(T)[] buff [@property getter]

Return array internal buffer which can be safely used while the array behaves as a hard reference.

capacity
size_t capacity [@property getter]

Returns the capacity of the array.

count
size_t count [@property getter]

Total count of (possibly dead) weak references.

hard
bool hard [@property getter]

Determines whether array behaves as a hard reference. false by default.

Meta