ref class by value built-in

Handle to an object of any reference type

Holds a handle without knowing the type of the object, e.g. to keep different kinds of objects in one array<ref>. Use handle assignment to store an object, @r = obj;, and cast<T>(r) to get a typed handle back. The is operator compares identity, e.g. r is obj or r is null.

Constructors

ref()
Creates a null handle
ref(const ref&in)
Creates a handle to the same object as another ref
ref(const ?&in)
Creates a handle to the given object

Operators

void opCast(?&out outRef) cast
Converts to a typed handle
bool opEquals(const ref&in o) const == C++
Returns whether both handles refer to the same object
bool opEquals(const ?&in ref) const == C++
Returns whether this handle refers to the given object
ref& opHndlAssign(const ref&in other) @= C++
Makes this handle refer to the same object as another ref
ref& opHndlAssign(const ?&in ref) @=
Makes this handle refer to the given object

Operator documentation

void ref::opCast(?&out outRef) cast

Converts to a typed handle

Used by cast<T>(r). Returns null if the handle is null or the object isn't of type T or a type derived from it.

ref& ref::opHndlAssign(const ?&in ref) @=

Makes this handle refer to the given object

Assigning null clears the handle.