Pretty print struct field values

Jacob Carlborg doob at me.com
Mon Apr 25 13:07:01 PDT 2011


On 2011-04-25 18:47, Andrej Mitrovic wrote:
> 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.

I'm not sure I understand but do you want to print "properties" in this 
case?

> 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)


-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list