pointers-to-members, (custom) array implementation
Sean Kelly
sean at f4.ca
Thu Feb 8 09:23:34 PST 2007
Frits van Bommel wrote:
> 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...
The latter :-)
Sean
More information about the Digitalmars-d
mailing list