getThis

Allows to get the original this of a struct, for example when passed from a ref getter function.

void*
getThis
(
T
)
(
ref T t
)
if (
is(T == struct)
)

Examples

1 static struct Bar {uint[64] ui;}
2 class Foo
3 {
4     Bar bar;
5     ref Bar barRef(){return bar;}
6     Bar barMov(){return bar;}
7 }
8 
9 Foo foo = construct!Foo;
10 assert(&foo.bar == foo.barRef.getThis);
11 Bar b = foo.barRef;
12 assert(&foo.bar != &b);
13 destruct(foo);

Meta