On Friday, 29 June 2018 at 20:28:55 UTC, Timoses wrote:
On Friday, 29 June 2018 at 16:44:36 UTC, Robert M. Münch wrote:

Trying to fiddle around a bit with delegates.. But why is the context for delegates not working for classes??

Aw.. Class = reference type so

class A { }
struct B { }
void delegate() del;
A a = new A();
del.ptr = a; // NOT its address, as that would be the address of the reference on the stack
B b = B();
del.ptr = &b   // value type => address of object in stack

... How would one print the address of the object then though?
Since &a is the address of the reference' types stack location.

cast(void*)a

would be on solution I guess.

Reply via email to