pointers-to-members, (custom) array implementation
Jarrett Billingsley
kb3ctd2 at yahoo.com
Wed Feb 7 19:22:09 PST 2007
"BCS" <BCS at pathlink.com> wrote in message
news:eqe3gf$159e$4 at digitaldaemon.com...
> 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);
Nope. Not only can you not use alias parameters in that way (they have to
be a declared symbol, not just an arbitrary identifier), but you also can't
call "obj.anything()" like "c.fn(1)".
I was hoping it might be possible to use mixin() to create an arbitrary
identifier, but unfortunately:
c.mixin("one")(i);
doesn't compile.
More information about the Digitalmars-d
mailing list