Struct ControlBlock
Control block for SharedPtr
, RcPtr
, UniquePtr
and IntrusivePtr
.
struct ControlBlock(_Shared, _Weak)
;
Contains ref counting and dynamic dispatching for destruction and dealocation of managed object.
Template parameters:
_Shared
signed integer for ref counting of SharedPtr
or void if ref counting is not necessary (UniquePtr
doesn't need ref counting).
_Weak
signed integer for weak ref counting of SharedPtr
or void if weak pointer is not necessary.
Constructors
Name | Description |
---|---|
this
()
|
Copy constructor is @disabled. |
Methods
Name | Description |
---|---|
opAssign
()
|
Assign is @disabled. |
Aliases
Name | Description |
---|---|
Shared
|
Signed integer for ref counting of SharedPtr or void if ref counting is not necessary (UniquePtr ).
|
Weak
|
Signed integer for weak ref counting of SharedPtr or void if weak counting is not necessary (UniquePtr or SharedPtr without weak ptr).
|
Example
static assert(is(ControlBlock!(int, long) .Shared == int));
static assert(is(ControlBlock!(int, long) .Weak == long));
static assert(is(ControlBlock!int .Shared == int));
static assert(is(ControlBlock!int .Weak == void));
static assert(ControlBlock!(int, int) .hasSharedCounter);
static assert(ControlBlock!(int, int) .hasWeakCounter);
static assert(is(ControlBlock!int == ControlBlock!(int, void)));
static assert(ControlBlock!int .hasSharedCounter);
static assert(ControlBlock!int .hasWeakCounter == false);
static assert(ControlBlock!void .hasSharedCounter == false);
static assert(ControlBlock!void .hasWeakCounter == false);