The Phobos Put

Steven Schveighoffer schveiguy at gmail.com
Thu Mar 30 13:27:33 UTC 2023


On 3/29/23 11:01 PM, Salih Dincer wrote:

> ```d
> import std.algorithm.mutation : copy;
> void main()
> {
>    int[8] buf;
>    auto dig = [1, 2, 3, 4];
>    auto rem = dig.copy(buf);
>    assert(rem.length == 4);
> }
> 
> ```
> 
> Looks like 'copy' has the same overload issue.

A static array is not a range of any kind. What would `popFront` do on a 
static array, since the length is part of the type?

But you can do `dig.copy(buf[])` since a dynamic array is.

-Steve


More information about the Digitalmars-d-learn mailing list