How to understand context type of a delegate?

NX nightmarex1337 at hotmail.com
Wed Sep 5 16:53:42 UTC 2018


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?


More information about the Digitalmars-d-learn mailing list