pointers-to-members, (custom) array implementation

Wolfgang Draxinger wdraxinger at darkstargames.de
Thu Feb 8 07:48:45 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);

Works but is IMHO not very elegant. Make PtM a language feature
and it's get a lot more readable. I don't like it.

Wolfgang Draxinger
-- 
E-Mail address works, Jabber: hexarith at jabber.org, ICQ: 134682867




More information about the Digitalmars-d mailing list