Using output-range overloads of SysTime.toISO{Ext}String with formatting code
Mitacha
mateusz.mitaszka at gmail.com
Tue Jul 9 08:51:59 UTC 2019
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.
More information about the Digitalmars-d-learn
mailing list