<div dir="ltr">Is there a way to do the following lazily:<div><br></div><div>writelnIfNotEmpty(T)(T a){</div><div>auto b=text(a);</div><div>if(b.length)</div><div>  writeln(b);</div><div>}</div><div><br></div><div>ie, without using std.conv.text (which needlessly computes an intermediate string, which could be quite large) or launching a separate process ?</div>
<div><br></div><div><div>writelnIfNotEmpty(""); //doesn't print new line<br></div></div><div><div>writelnIfNotEmpty("a"); //prints "a\n"<br></div></div><div><br></div><div><br></div><div>
<br></div><div><br></div></div>