Pointers to non-static member functions!

David Nadlinger see at klickverbot.at
Wed Jun 8 07:38:22 PDT 2011


Oh wow, my previous comment was total nonsense, I somehow confused .func 
with .funcptr ;)

Anyway, the thing to consider here is that &A.func inside a non-static 
member function returns a delegate to that member function. You are 
right that returning a delegate with a null context part is probably 
error prone, and manually creating a delegate and setting its .funcptr 
to a casted void* return is probably just as good as manually setting 
the context pointer is, but still I'm not sure what the best solution in 
the light of consistency is here.

David


More information about the Digitalmars-d mailing list