weak_ptr

A weak pointer.

Weak pointers point to memory owned by shared_ptr or unique_ptr. They do not own the memory allocation and said allocation may become null at any point.

Make sure to check the validity of the underlying value using isValid!

Constructors

this
this(__refcount_t!T* ptr)

Constructs a weak pointer from an internal refcount object.

this
this(inout(typeof(this)) src)

Copy Constructor.

Destructor

~this
~this()

Destructor.

Alias This

value

Members

Properties

isValid
bool isValid [@property getter]

Whether the smart pointer value is still valid.

value
T value [@property getter]

The value stored within the smart pointer.

See Also

nulib.memory.shared_ptr.shared_ptr nulib.memory.unique_ptr.unique_ptr

Meta