pointers-to-members, (custom) array implementation
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Thu Feb 8 09:20:08 PST 2007
Sean Kelly wrote:
> BCS wrote:
>>
>> I'd have to check but I think this works
>>
>> class C
>> {
>> int one(int i){...}
>> int two(int i){...}
>> int three(int i){...}
>> }
>>
>> int Pt2Mem!(alias go)(C c, int i)
>> {
>> return c.go(i);
>> }
>>
>>
>> auto fn = &Pt2Mem!(one);
>>
>> C c = new C;
>>
>> c.fn(1);
>
> Huh. I had no idea that free functions could be called this way with a
> class as the first parameter. I thought it only worked for arrays.
Either you're being sarcastic or you didn't even _try_ to compile that...
More information about the Digitalmars-d
mailing list