Array operations with array of structs

Peter via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jul 11 06:31:11 PDT 2015


On Wednesday, 8 July 2015 at 06:05:54 UTC, ketmar wrote:
> do you see the gotcha? if you uncomment postblit or assigns, 
> this build function fails to compile, as that operations aren't 
> "pure nothrow @nogc @trusted", and they will be used for either 
> assign or postblitting.

So after looking into it a little bit...

It looks like the opAssigns can take all the attributes without 
throwing errors so that's good.

The postblit can only not take @nogc due to the array duplication 
which is understandable.
I think the postblit might be redundant anyway since the struct 
is built on a static array so there is no possibility of two 
different Vect3s "pointing" to the same data.
Can someone confirm or does the postblit do anything else?



More information about the Digitalmars-d-learn mailing list