Member function pointers

Michel Fortin michel.fortin at michelf.ca
Fri Jun 7 19:29:19 PDT 2013


On 2013-06-07 23:57:40 +0000, Manu <turkeyman at gmail.com> said:

> Precisely. The concept is already embedded inside of delegate, but delegate
> is framed like a piece of magic, rather than a well defined compound of
> more primitive pieces.

Delegates are not parametrized on the type of "this", which makes them 
easier to move around. I would not change delegates.

But function pointers with a "this" parameter would be useful. You can 
achieve this using a template struct containing a pointer and a call 
method: the call method would generate a local delegate variable from 
the pointer and and call it. What you can't do without compiler support 
is get such a pointer in a type-safe manner.

-- 
Michel Fortin
michel.fortin at michelf.ca
http://michelf.ca/



More information about the Digitalmars-d mailing list