std.range's put on arrays needs to change
WebFreak001
d.forum at webfreak.org
Sun Jun 26 13:30:57 UTC 2022
On Sunday, 26 June 2022 at 10:58:48 UTC, Kostiantyn Tokar wrote:
> 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`.
no, the suggestion is only to deprecate the `put` for slices and
disallow it completely with that function name, to avoid errors
in code bases.
Appending to the slice would not work because of the `@nogc`
change and also because it's a backwards-incompatible breaking
change.
More information about the Digitalmars-d
mailing list