On Monday, 8 July 2019 at 12:53:18 UTC, Digital Mars wrote:
08.07.2019 13:38, Joseph Rushton Wakeling пишет:
[...]
Sorry that my answer wasn't thoughtful.
I guess that there is no way to have `writeln` automatically
use the output range overload instead of allocating one. You
need somehow to provide the output range to `toISOExtString`
explicitly because `writeln` outputs the return of
`toISOExtString` and have no ability to use specific overload.
That is compiler calls `toISOExtString` and then passes its
return to `writeln`. Probably library solution isn't possible
in this case. Workaround is using own wrapper to provide output
range to `toISOExtString`.
I've managed to make it work using 'alias this' and wrapper
struct.
https://run.dlang.io/is/3SMEFZ
It's not an elegant solution, there could be a better way to do
this.