std.range's put on arrays needs to change

Kostiantyn Tokar tokarkonstantyn at yandex.ua
Sun Jun 26 10:58:48 UTC 2022


On Sunday, 26 June 2022 at 10:29:17 UTC, H. S. Teoh wrote:
> On Sun, Jun 26, 2022 at 06:33:13AM +0000, Kostiantyn Tokar via 
> Digitalmars-d wrote: [...]
>> What should I do if I want to preallocate a slice and copy 
>> some input range into it? I wouldn't be able to use 
>> `std.algorithm.copy` for this simple purpose, because it uses 
>> `put` internally.
>
> Just take a slice of it with [].
>
>
> T

I'm talking about suggestion. IIUC, with suggested change `put` 
will be appending to the slice. And it wouldn't work with `@nogc`.


More information about the Digitalmars-d mailing list