delegate bug?

Timon Gehr timon.gehr at gmx.ch
Fri Nov 9 12:18:21 PST 2012


On 11/09/2012 07:49 PM, Jack Applegame wrote:
>> Because this is a learning group and not a teaching group--and you did
>> not report on your fruitless tries: go on.
>>
>> -manfred
> This is not only std::function feature. In C++ we can call
> member-function by combining potinter to object and pointer to function:
>
> http://liveworkspace.org/code/1fe3107cf3a311aa95cb9fc62b9117a7
>
> I have no idea how to do somethink like that in D.
>
>

auto memberFunctionPointer = function(X receiver, A arg0, B arg1, C 
arg2)=>receiver.memberFunction(arg0, arg1, arg2);


This strategy is also the best way for a C++ compiler to implement a 
standard conformant member function pointer behind the scenes, so you 
lose nothing.


More information about the Digitalmars-d-learn mailing list