alias of member from pointer to struct?

BCS ao at pathlink.com
Mon Apr 16 17:16:28 PDT 2007


Reply to Jarrett,

> I should hope that in reality the body of go() is long enough to even
> warrant the use of such an alias.  Otherwise:
> 
> int go(bool pick)(S* bar)
> {
> static if (pick)
> return i % bar.j;
> else
> return j % bar.i;
> }

Yes, in fact it is. However the point is more to try and get as little redundancy 
as possible. An ideal solution would never have the same expression more 
than one if the second copy is in fact the exact same. I'm sort of taking 
to an extreme the reason that it's in a template in the first place (I don't 
want to wright n almost identical function).




More information about the Digitalmars-d-learn mailing list