Getting nice print of struct for debugging

Jacob Carlborg via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Feb 24 03:09:17 PST 2017


On 2017-02-22 12:18, Martin Tschierschke wrote:

> Exactly what I was looking for, **thank you!**
> Both ways of accessing the struct elements are very interesting,
> giving an impression what is possible with D.
>
>
> Is it possible to overwrite "toString" for all structs in one step?

It depends. You can create a template mixin containing the 
implementation of toString, which need to be mixed in in all structs. Or 
you can create a new function that can convert any passed in structs in 
a generic way. It depends on what you need the string for.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list