Array Copying syntax

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Sep 16 11:54:07 PDT 2016


On 09/16/2016 10:11 AM, Adam D. Ruppe wrote:
> On Friday, 16 September 2016 at 17:03:20 UTC, Antonio Corbi wrote:
>> Is it safe to use or do I have to use the proposed 's[] = t;' or 's[]
>> = t[]' ?
>
> That works for all arrays. `s = t` for dynamically sized arrays (aka
> slices) just sets the references to the same, but for your statically
> sized arrays, it also copies.
>
>

A short section of mine about that difference:

   http://ddili.org/ders/d.en/slices.html#ix_slices.assignment,%20array

Ali



More information about the Digitalmars-d-learn mailing list