Re: toString best practices

2023-02-17 Thread Paolo Invernizzi via Digitalmars-d-learn
On Wednesday, 15 February 2023 at 12:15:18 UTC, Bastiaan Veelo wrote: On Thursday, 9 February 2023 at 17:49:58 UTC, Paolo Invernizzi wrote: ``` import std.format, std.range.primitives; struct Point(T) { T x, y; void toString(W)(ref W writer, scope const ref FormatSpec!char f) const

Re: toString best practices

2023-02-15 Thread Bastiaan Veelo via Digitalmars-d-learn
On Thursday, 9 February 2023 at 17:49:58 UTC, Paolo Invernizzi wrote: ``` import std.format, std.range.primitives; struct Point(T) { T x, y; void toString(W)(ref W writer, scope const ref FormatSpec!char f) const if (isOutputRange!(W, char)) { put(writer, "(");

toString best practices

2023-02-09 Thread Paolo Invernizzi via Digitalmars-d-learn
Hello everybody, Let's assume there's an implementation of a templated struct like this: ``` import std.format, std.range.primitives; struct Point(T) { T x, y; void toString(W)(ref W writer, scope const ref FormatSpec!char f) const if (isOutputRange!(W, char)) { put