Perfect forwarding

Chad Joan chadjoan at gmail.com
Fri Jul 31 23:08:38 UTC 2020


On Friday, 31 July 2020 at 13:48:37 UTC, Paul Backus wrote:
> On Friday, 31 July 2020 at 09:10:44 UTC, Chad Joan wrote:
>>
>> I am considering putting a "stringize" method in my types, 
>> with a signature (by convention) like so:
>> @nogc nothrow void stringize(return scope StringVacuum writer) 
>> { ... }
>>
>
> Are you aware that toString already supports this kind of 
> overload?
>
> The documentation for it is under `std.format.formatValue`, so 
> it is a bit easy to miss:
>
> https://dlang.org/phobos/std_format.html#.formatValue

I was not. That's good to know. This one even accepts an 
OutputRange. Cool.

Thanks!


More information about the Digitalmars-d mailing list