WeakReference

Implements weak reference.

Note: The class contains a pointer to a target object thus it behaves as a normal reference if placed in GC block without NO_SCAN attribute.

Tip: This behaves like C#'s short weak reference or Java's weak reference.

final @trusted
class WeakReference (
T
) if (
isWeakReferenceable!T
) {}

Constructors

this
this(T target)
Undocumented in source.

Destructor

~this
~this()
Undocumented in source.

Members

Properties

alive
bool alive [@property getter]

Determines whether referenced object is finalized.

target
inout(T) target [@property getter]

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

Meta