Weird template error

Jarrett Billingsley jarrett.billingsley at gmail.com
Tue Nov 25 20:55:51 PST 2008


On Tue, Nov 25, 2008 at 10:44 PM, Nick Sabalausky <a at a.a> wrote:
>       // compiler knows that foo.x is an int property
>       // and turns this:
>       makeTen(foo.x);
>
>       // into this:
>       auto _foo_x = foo.x;
>       makeTen(_foo_x);
>       foo.x = _foo_x;
>
>       // and finally this:
>       auto _foo_x = foo.x.get();
>       makeTen(_foo_x);
>       foo.x.set(_foo_x);

I considered this, but what if your setter/getter had some kind of
side effect?  I know, it's probably a little thing to worry about, but
still, I would have intuitively expected it to have been evaluated
each time the ref parameter was accessed in the function instead of
just once before and after the call.



More information about the Digitalmars-d mailing list