Built-in array opSliceAssign

Eduard Staniloiu edi33416 at gmail.com
Thu Oct 25 13:22:36 UTC 2018


On Thursday, 25 October 2018 at 12:55:38 UTC, Adam D. Ruppe wrote:
> On Thursday, 25 October 2018 at 12:25:37 UTC, Eduard Staniloiu 
> wrote:
>> IMHO, this is a bug. The code should lower to calls to 
>> opAssing for types that define opAssign.
>
> The spec doesn't exactly say it uses memset, but it does imply 
> it:
>
> https://dlang.org/spec/arrays.html#array-copying
>
> talking about "aggressive parallel code optimizations than 
> possible with the serial semantics of C" and "copying" rather 
> than "assigned" etc.
>
> but indeed postblit lets this work.

You are right. Thank you!

I guess I never read/understood it like this.
I expected it to use opAssign as that is what's the most natural 
and intuitive decision for me.

I take it that this is the expected behaviour, then.


More information about the Digitalmars-d-learn mailing list