On 05/29/2012 12:18 PM, Sharp wrote:

> public ref T foo(T)() {
> T *ret = new T;
> // DON'T WORK
> // Looping through fields in this way doesn't modify the object
> auto fields = ret.tupleof;

Looks like fields is a local copy of ret.tupleof so the following modifies just that copy.

> foreach(ref field; fields) {
> field = 1; // this doesn't alter 'ret'
> }

Ali

Reply via email to