[phobos] Converting function pointers to delegates
David Simcha
dsimcha at gmail.com
Sat Jan 30 16:14:29 PST 2010
A pretty significant wart of D is that function pointers and delegates
are completely incompatible. I've come up with a good hack to convert
function pointers to delegates without any heap allocations or
additional storage besides the delegate itself being used. In
particular, there are no heap allocations, closures, etc. involved.
However, calling a delegate created from a function pointer does still
incur two indirect function calls instead of one. I've attached the
code. Tell me what you think.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: delegateFromFp.d
URL: <http://lists.puremagic.com/pipermail/phobos/attachments/20100130/648e4165/attachment.asc>
More information about the phobos
mailing list