ref is pointer sugar?

Pluto pluto at planets.not
Fri Aug 6 05:51:31 PDT 2010


Are these equivalent?

S s;//struct

void f(ref S s){s.x++;}
f(s);

void f2(S* s){(*s).x++;}
f2(&s);

If so, why is it stated that ref is very rarely used?
It looks like something I would use a lot with structures.


More information about the Digitalmars-d-learn mailing list