Format

drug drug2004 at bk.ru
Sat May 22 13:21:31 UTC 2021


22.05.2021 06:07, cc пишет:
 > Looks like you have to stick with put()?

yes, OutputRange assumes put(). If put() does not support string 
(accepts char only) I use std.algorithm.copy.

22.05.2021 07:58, cc пишет:
> On Saturday, 22 May 2021 at 03:14:35 UTC, cc wrote:
>> Oops, disregard this.  I had an error in my imports.😓
>> It does in fact work in @safe.
> 
> I should add as an aside then that there is an issue of errors from the 
> body of a toString template not being displayed, and instead the 
> template being silently skipped, e.g.:

yes, it's really annoying because you need to write additional code to 
reveal the error like you do:

> 
> Something like this can help reveal errors, not sure if there's an 
> easier way:
> ```d
> unittest {
>      struct DebugWriter {
>          void put(C)(C c) {}
>      }
>      DebugWriter wr;
>      Foo foo;
>      foo.toString(wr);
> }
> ```
> `Error: undefined identifier 'syntactically'`
> `Error: template instance 'amemfailuretest.Foo.toString!(DebugWriter)' 
> error instantiating`



More information about the Digitalmars-d-learn mailing list