PtrState

Pointer variable states:

Initial state is not known; ignore for now

Undefined not in a usable state

T* p = void;

Owner mutable pointer

T* p = initializer;

Borrowed scope mutable pointer, borrowed from p

T* p = initializer; scope T* b = p;

Readonly scope const pointer, copied from p

T* p = initializer; scope const(T)* cp = p;

Values

ValueMeaning
Initial
Undefined
Owner
Borrowed
Readonly

Examples

T* p = initializer; // p is owner T** pp = &p; // pp borrows from p

T* p = initialize; // p is owner T* q = p; // transfer: q is owner, p is undefined

Suggestion Box / Bug Report