SharedPtr<T>
Struct · built-in type
struct SharedPtr<T>A value in a reference-counted box that threads can share: SharedPtr<T>.Create(value) moves the value into the
box, copies of the SharedPtr share it, and the last one frees it. The reference count is atomic, so copies can
go to other threads; the value must then be thread-safe itself (no strings, arrays or containers inside).
The value is not locked: concurrent changes through SharedPtr<T>.Ptr need their own synchronization, or a
Mutex.
Static methods
Section titled “Static methods”| Name | Description |
|---|---|
Create |
A new box with value. |
Create
Section titled “Create”static SharedPtr<T> Create(T value)A new box with value.
Methods
Section titled “Methods”| Name | Description |
|---|---|
IsNull |
Whether there is no box (a null or default SharedPtr). |
Get |
A copy of the value in the box. |
Ptr |
A pointer to the value in the box, for changing it in place (unsafe). |
IsNull
Section titled “IsNull”bool IsNull()Whether there is no box (a null or default SharedPtr).
T Get()A copy of the value in the box.
T* Ptr()A pointer to the value in the box, for changing it in place (unsafe).