Format
newbie
newbie at no.com
Fri May 21 14:19:03 UTC 2021
On Friday, 21 May 2021 at 13:59:13 UTC, drug wrote:
> 21.05.2021 16:45, newbie пишет:
>> I am following
>> https://wiki.dlang.org/Defining_custom_print_format_specifiers, why sink and formatValue are not @safe? What are the best practice for toString in safe code? Thank you
>
> sink is obsolete now, use W(riter)
>
> ```D
> import std.range : isOutputRange;
>
> void toString(W)(ref W writer) const
> if (isOutputRange!(W, char))
> {
> // your stuff
> }
> ```
> writer can be @safe, @nogc, nothrow etc like you want
Thank you, and formatValue?
More information about the Digitalmars-d-learn
mailing list