On 8/5/22 01:59, frame wrote:
> On Thursday, 4 August 2022 at 22:14:26 UTC, Ali Çehreli wrote:
>
>> No element is copied or moved. :)
>>
>> Ali
>
> I know that :)

And I know that. :) We don't know who else is reading these threads, so I didn't want to give wrong impression.

Copying would happen if we added slicing on the left-hand side. However, I realized that the following fails with a RangeError:

void main() {
  auto arr = [1, 2, 3];
  arr[0..$-1] = arr[1..$];    // <-- Runtime error
}

I suspect the length of the array is stamped too soon. (?)

Should that operation be supported?

Ali

  • Ranges pascal111 via Digitalmars-d-learn
    • Re: Ranges Salih Dincer via Digitalmars-d-learn
    • Re: Ranges frame via Digitalmars-d-learn
      • Re: Ranges Ali Çehreli via Digitalmars-d-learn
        • Re: Ranges pascal111 via Digitalmars-d-learn
        • Re: Ranges frame via Digitalmars-d-learn
          • Re: Ranges Ali Çehreli via Digitalmars-d-learn
    • Re: Ranges Ali Çehreli via Digitalmars-d-learn

Reply via email to