On Thursday, 30 March 2023 at 13:27:33 UTC, Steven Schveighoffer wrote:
But you can do `dig.copy(buf[])` since a dynamic array is.


Apparently, we will not be able to get rid of the necessity of using slices. 😀 Neither with "copy" nor with "put"...

```d
import std.algorithm.mutation : copy;
import std.range.primitives : put;

void main()
{
  int[8] buf;// = new int[8];
  auto dig = [1, 2, 3, 4];

  //dig.copy(buf[2..$-2]);/*
  auto slice = buf[2..$-2];
  dig.copy(slice);
  
  assert(buf == [0, 0, 1, 2, 3, 4, 0, 0]);
  buf = 0;
  slice.put(dig);//*/
  assert(buf == [0, 0, 1, 2, 3, 4, 0, 0]);
}
```
SDB@79

Reply via email to