I was sketching some simple event-listener code and looked up std.signals module for some inspiration. Documentation says that it only works if the delegate used for slots are a class/interface member function. Digging into the code it seems like it's because _d_toObject(void*) function is used by passing "ptr" variable of the delegate to it. If there was a way to distinguish context types of delegates this would not be a problem.

Is there a way to know what kind of context a delegate has either in compile time or runtime?

Also is there any way to check whether a pointer legitimately points to an Object instance?

Reply via email to