How to add a character literal to a string without ~ operator?

Ferhat Kurtulmuş aferust at gmail.com
Fri Apr 5 05:26:18 UTC 2024


On Thursday, 4 April 2024 at 21:23:00 UTC, user1234 wrote:
> On Thursday, 4 April 2024 at 19:56:50 UTC, Ferhat Kurtulmuş 
> wrote:
>> [...]
>
> ```d
> module runnable;
>
> import std.stdio : writeln;
> import std.range : chain;
>
> void main() @nogc
> {
>     auto s = chain("as ", "df ", "j"); // s is lazy
>     writeln(s);
> }
> ```
>
> Bad example. The range is indeed a `@nogc` lazy input range but 
> `writeln` is not a `@nogc` consumer.
>
>> [...]
>
> The input range consumer has to be @nogc as well.

I don't understand your point sorry. I didn't imply anything 
about @nogc. I of course know writeln is not nogc. I just kept 
the example simple.


More information about the Digitalmars-d-learn mailing list