Pretty print struct field values

Andrej Mitrovic andrej.mitrovich at gmail.com
Mon Apr 25 09:47:04 PDT 2011


Good idea. .tupleof seems to avoid collecting functions which is
perfect. Here's a quick implementation:

http://codepad.org/lSDTFd7E

The only issue I have left is that the function that prints the code
doesn't really know what the variable was named in the calling code.

As an alternative I could pass "myvar.stringof" and it would print its
name before all field names instead of the type name.

Btw, it seems CTFE doesn't work with this syntax:
foreach (index; 0..100)

But it does work with this syntax:
foreach (index, value; values)


More information about the Digitalmars-d-learn mailing list