<div>Greetings</div><div><br></div><div>Please look at the code down here. When compiled and run, I get the message "Call to postblit" printed. I think it is because of the foreach block, because the variable "i" is not declared as ref there. Is there a way to make it a ref?</div>
<div><br></div><div>Regards</div><div>- Puneet</div><div><br></div><div>import std.stdio;</div><div><br></div><div>struct Foo {</div><div> this(this) {</div><div> writeln("Call to postblit");</div><div> }</div>
<div>}</div><div><br></div><div>class Bar {</div><div> Foo foo;</div><div> this() {</div><div> foreach(i, f; this.tupleof) {</div><div> // do nothing</div><div> }</div><div> }</div><div>}</div><div><br></div>
<div>void main()</div><div>{</div><div> Bar bar = new Bar();</div><div>}</div><div><br></div>