UnqualRef

Similar to Rebindable!(T) but strips all qualifiers from the reference as opposed to just constness / immutability. Primary intended use case is with shared (having thread-local reference to shared class data)

template UnqualRef (
T
) if (
is(T == class) ||
is(T == interface)
) {}

Parameters

T

A class or interface type.

Examples

1 class Data {}
2 
3 static shared(Data) a;
4 static UnqualRef!(shared Data) b;
5 
6 import core.thread;
7 
8 auto thread = new core.thread.Thread({
9     a = new shared Data();
10     b = new shared Data();
11 });
12 
13 thread.start();
14 thread.join();
15 
16 assert(a !is null);
17 assert(b is null);

Meta

Suggestion Box / Bug Report