Using output-range overloads of SysTime.toISO{Ext}String with formatting code

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Tue Jul 9 16:26:21 UTC 2019


On Monday, 8 July 2019 at 12:53:18 UTC, Digital Mars wrote:
> 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`.

This is pretty much what I'd concluded myself, but I wanted to 
check to make sure there wasn't some clever option I didn't know 
about.  A helper function with wrapper struct seems the obvious 
way forward.


More information about the Digitalmars-d-learn mailing list