easy way to output a struct?

Hoenir mrmocool at gmx.de
Thu Jan 15 10:45:17 PST 2009


Denis Koroskin schrieb:
> One note is that you should probably pass the object by reference:
> 
> void log(T)(ref T obj) { ... }        // D1
> void log(T)(ref const(T) obj) { ... } // D2
> 

Good idea. btw ref'ing a class has no effect, has it?

Actually discovered a flaw, if you e.g. pass an array of structs to it, 
dmd complains about the struct not having a toString() member.

So it needs to be recursive somehow.


More information about the Digitalmars-d-learn mailing list