toString refactor in druntime

Kagamin via Digitalmars-d digitalmars-d at puremagic.com
Wed Oct 29 02:47:57 PDT 2014


On Tuesday, 28 October 2014 at 23:06:32 UTC, Manu via 
Digitalmars-d wrote:
> I haven't thought of one I'm really happy with.
> I can imagine some 'foolproof' solution at the API level which 
> may
> accept some sort of growable string object (which may represent 
> a
> stack allocation by default). This could lead to a virtual call 
> if the
> buffer needs to grow, but that's not really any worse than a 
> delegate
> call, and it's only in the rare case of overflow, rather than 
> many
> calls in all cases.

If you want to combine two approaches of writing data, you will 
need to write toString logic twice, both variants intertwined on 
every byte written.


More information about the Digitalmars-d mailing list