Shared

Undocumented in source.

Constructors

this
this(AllocatorWrapperOf!AllocT alloc)
Undocumented in source.
this
this(T value, AllocatorWrapperOf!AllocT alloc)
Undocumented in source.
this
this(typeof(this) copy)
Undocumented in source.

Destructor

~this
~this()
Undocumented in source.

Members

Functions

createNewStore
void createNewStore(T value)
Undocumented in source. Be warned that the author may not have intended to support it.
opAssign
void opAssign(typeof(null) n)
Undocumented in source. Be warned that the author may not have intended to support it.

Mixins

__anonymous
mixin accessFuncs!true
Undocumented in source.

Properties

isNull
bool isNull [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
ptrUnsafe
inout(T)* ptrUnsafe [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

1 int dtor;
2 static struct S
3 {
4     int value;
5     int* dtor;
6     @disable this(this);
7 
8     ~this() @nogc nothrow
9     {
10         if(dtor)
11             (*dtor)++;
12     }
13 }
14 
15 // Simple
16 {
17     auto a = S(200, &dtor).makeShared;
18 }
19 assert(dtor == 1);
20 dtor = 0;
21 
22 // Copying
23 {
24     auto a = S(200, &dtor).makeShared;
25     auto b = a;
26 }
27 assert(dtor == 1);
28 dtor = 0;
29 
30 // Copying over existing
31 {
32     auto a = S(200, &dtor).makeShared;
33     auto b = S(400, &dtor).makeShared;
34     b = a;
35 }
36 assert(dtor == 2);
37 dtor = 0;
38 
39 // Null assign
40 {
41     auto a = S(200, &dtor).makeShared;
42     a = null;
43     assert(dtor == 1);
44 }
45 
46 // Access
47 {
48     auto a = S(200, &dtor).makeShared;
49     auto b = a;
50 
51     b.access((scope ref v)
52     {
53         v.value *= 2;
54     });
55     assert(a.ptrUnsafe.value == b.ptrUnsafe.value);
56     assert(a.ptrUnsafe.value == 400);
57 }

Meta