pointers-to-members, (custom) array implementation
Sean Kelly
sean at f4.ca
Thu Feb 8 09:12:38 PST 2007
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.
Sean
More information about the Digitalmars-d
mailing list