Converting an integer to a string with std.format.

Per Nordlöw per.nordlow at gmail.com
Mon Jan 7 13:32:53 UTC 2019


On Monday, 7 January 2019 at 09:57:45 UTC, Daniel Kozak wrote:
> I would go with std.conv.to or std.conv.text :)

The reason for not using std.conv.to is to prevent the extra 
allocation needed in code such as

     sink.put(someIntegral.to!string)

instead of something like

     sink.putIntegralAsString(someIntegral)

which should only extend the memory buffer of `sink` (via at most 
one allocation or reallocation).


More information about the Digitalmars-d-learn mailing list