Value | Meaning |
---|---|
no | Do not auto-initialize the object |
yes | Auto-initialize the object |
1 import core.exception : AssertError; 2 import std.exception : assertThrown; 3 4 struct Foo 5 { 6 int a = 42; 7 } 8 9 RefCounted!(Foo, RefCountedAutoInitialize.yes) rcAuto; 10 RefCounted!(Foo, RefCountedAutoInitialize.no) rcNoAuto; 11 12 assert(rcAuto.refCountedPayload.a == 42); 13 14 assertThrown!AssertError(rcNoAuto.refCountedPayload); 15 rcNoAuto.refCountedStore.ensureInitialized; 16 assert(rcNoAuto.refCountedPayload.a == 42);
Options regarding auto-initialization of a RefCounted object (see the definition of RefCounted below).